ad

Sunday, July 28, 2024

JavaScript If else statement

 JavaScript If..else statement



JavaScript If..else statement


What is the JavaScript If else statement.

 1] When the given condition is true, a block of code is executed by the JavaScript if...else statement. 
2] The else block will be Execute in the event that the condition is false. 
3] A program's execution flow may be managed using the if-else statements depending on path.
4] There may be times when you have to choose one path from a list while building a software.
5]  In these situations, you must utilize conditional statements to enable your program to decide what to do and how to do it.

JavaScript If..else statement



Syntax :-


if (expression)
{
//statement evaluated  if condition True
}
else
{
statement evaluated if condition False
}


JavaScript If..else statement

Flowchart :-


JavaScript If..else statement





Q.JavaScript If ..else Statement  check student result.

Example :-


let marks= 90;
if(marks<=95)
{
    console.log("student pass");
}
else
{
    console.log("student failed");
}

Output :-
JavaScript If..else statement



Q.JavaScript If ..else Statement  Even or odd number.

Example :-


let x= 90;
if(x%2==0)
{
    console.log("Even number");
}
else
{
    console.log("odd number");
}

 

Output :-

JavaScript If..else statement

Q.JavaScript If ..else Statement  check student eligible for voting or not .

Example :-


let student_age= 21;
if(student_age>=18)
{
    console.log("student Eligible
for voting ");
}
else
{
    console.log("student not Eligible
for voting");
}

Output :-

JavaScript If..else statement


Related Post JavaScript :-

css column gap property

php if else statements

css box margin property

forgot password form

JavaScript switch statement

     JavaScript Switch  Statement 


JS switch statement


what is the switch case statement in javascript language?

1] switch case  number of codition.
2] switch case one code execute and handle multiple  condition in javaScript .
3] switch case alternative series provides else if and else JavaScript.
4] Switch case check to the single value multiple possible case.
5] Switch case match to the condition  inside the case than block executed and /end the conditon .
6] Switch case  in case statement is not match then condition default block executed.

Syntax Switch Statement  


switch (expression)
{
case value1: 
// code executed
 // if expression  == value1
break;

case value2: 
// code executed
 // if expression  == value2
break;

case value3: 
// code executed
 // if expression  == value3
break;

case value N: 
// code executed
 // if expression  == value N
break;

default:
//code executed if expression does not match any case 
}

Q.  switch case  Program of day 

Example :-
Source code 

let day =5;
switch(day)
{
    case 0:
        console.log('Sunday');
        break;
        case 1:
            console.log('Monday');
            break;
            case 2:
        console.log('Tuesday');
        break;
        case 3:
            console.log('Wednesday');
            break;
            case 4 :
        console.log('Thursday');
        break;
        case 5:
            console.log('Friday');
            break;

            case 6:
            console.log('Saturday');
            break;
            default:
                console.log('invalid day')

}



OutPut :-

Q2] . Switch case  program of month 

 Example 

source code


let month = 9;
switch(month)
{
    case 0:
        console.log('January');
        break;
        case 1:
            console.log('February');
            break;
            case 2:
        console.log('March');
        break;
        case 3:
            console.log('April');
            break;
            case 4 :
        console.log('May');
        break;
        case 5:
            console.log('June');
            break;

            case 6:
            console.log('July');
            break;
                case 7:
                        console.log('August');
                        break;
                        case 8:
                            console.log('September');
                            break;
                            case 9:
                        console.log('October');
                        break;
                        case 10:
                            console.log('November');
                            break;
                            case 11 :
                        console.log('December');
                        break;
                       default:
                      console.log('invalid Month')
               
            }

Output :-



Q3] . Switch case  program Programming language

 Example 

source code:-


let  language = "JS";
switch( language)
{
    case "H":
        console.log('HTML');
        break;
        case "C":
            console.log('CSS');
            break;
            case "J":
        console.log('Java');
        break;
        case "JS":
            console.log('JavaScript');
            break;
            case "P":
        console.log('PHP');
        break;
        case "C":
            console.log('C++');
            break;

            case "B":
            console.log('Bootstrap');
            break;
                 default:
                 console.log('invalid Programming language');
               
            }

Output :-




Related Post JAVASCRIP :-

Monday, July 22, 2024

javaScript do while loop


        

 JavaScript  Do While loop 


what is the Javascript  do .. While loop?

1] The do...while loop in JavaScript is a control flow statement that continually runs a block of code until a given condition is evaluated to false. 

2] While a do...while loop is similar to a while loop, the main distinction is that the code block is run at least once before the condition is verified.


Syntax :-

do 

{

code executed

}

while (condition)


do :-

1] keyword starts the loop.

2] block of code executed first.

while :-

1] keyword condition that is evaluated after execute of the block of code.

2] condition evaluates true  block of code executed again than condition false the loop terminates.

FlowChar :-

 Do while loop


javascript  do while loop 

1] Example

Q.  Display  Number 10 to 1 

Source code

let a=10;
do{
    console.log(a);
    a--;

}while (a>0);

Explain program :-

1] a starts at 10 .

2] loop prints value of a and decrement (a--) after each iteration 

3] condition run long i  greater than 0

Display  Number 10 to 1 

Output 

Display  Number 10 to 1  javascript

JavaScript do  while loop 

2] Example

Q. display number 11 to 20 using do.. while loop


let i = 11;
do {
  console.log(i);
  i++;
} while (i <= 20);


JavaScript  do while loop 

Output :-

javascript  while loop


JavaScript  do while loop 


3] Example

Q. user input using do while loop


let input ;
do {
    input =prompt("Enter a no between 1 to 100 ");
}
while (input <1 || input > 100 );
console.log("enter your number- " +input);

JavaScript Do while loop

Output:- 

javascript do- while loop

JavaScript do while loop 

4] Example

Q. javascript that iteration 28 times 


let count =0;
do {
    console.log("count number-", count);
    count++;

}
while(count<28);

JavaScript  do while loop 

 Output:-

javascript  do while loop


Related Post :-

php program to print alphabet pattern R

php program to print half diamond pattern

javascript operators

how to create a navigation bar

Friday, July 19, 2024

Introduction to Java

  

Introduction to Java

what is the java

 1] Java is a popular programming language that is flexible and platform independent.

 2] Java, developed in 1995 by Sun Microsystems (now Oracle), allows applications to execute on any device that has a Java Virtual Machine (JVM).

 3]  Java does this by using a bytecode compilation paradigm. 

 4] It may be used to create scalable and reliable programs because it supports encapsulation, inheritance, and polymorphism—principles of object-oriented programming. 

 5] Java is favored in online, corporate, and mobile development because to its robust standard library, automated memory management, and security focus.

 6] Java wide ecosystem and sizable community further establish it as the best option for a variety of software development requirements.

 History of java 

ஃ java  creating  java programming simple robust, portable, platform,-independent,multithreaed,         secured ,high  performance.

ஃ    james gosling , patrick naughton initiated,mike sheridan the java language project 1991 june.

ஃ java initially was designed for small ,embedded system in set-top boxes and electronic application.

ஃ  java firstly called "Greentalk" by James Gosling, and file extension .gt.

ஃ After than called Oak and was developed part of Green Project.

Why Oak called

  O   Oak is symbol strength and national tree of many countries

  O      like  Romania, France, U.S.A , Germany.

  O   Oak  1996 was renamed as java reason  it already a trademark by Oak Technologies.


Why JAVA named by " JAva"

In 1995, the developers of Java at Sun Microsystems gave it its name. The term "Java" was selected as a tribute to Java coffee, which is well-known for being widely available and well-liked worldwide. Like the beverage, the developers of Java programming language wanted it to be widely used and accessible.  

  Additionally, the name was a short, memorable, and trademark-friendly choice that aided in branding and marketing initiatives. These days, Java is widely used to power applications on a variety of platforms and devices because to its resilience, portability, and adaptability.

 

Applications  OF JAVA 

1] java is  easy to learn and simple used.

2] java open-source and free .

3] java object oriented programming language.

4]  java is the large demand in market .

6] java is secure. java use IOT Application

7]  web Development  :-

   java is use server-side  web development.A lot of server-side web development is done with Java. Web applications may be made scalable and safe by developers with the help of frameworks like Spring and Java EE (Enterprise Edition).

8]   Mobile Application :-

A large percentage of mobile apps worldwide are powered by Java, notably through the creation of Android applications. The Java-based development environment of Android Studio makes it easier to create Android apps.

9] Big Data Technologies :-

java  use big data processing frameworks such as Apache Hadoop or Apache Spark to handling large volumes of data and scalability across clusters.

10] Financial Services :-

java is the widely use finance industry for building trading platforms,risk management systems,platforms , banking application and scalability.

11] Education Purpose :-

 java use readability and extensive documentation make popular choice for teaching programming.many universities and educational institutions use java as primary language for introducatory programming 

12] server side technolog :-

 java is the backbone of server  and frameworks like Apache Tomcat, jetty, powering dynamic web applications and services.

13]  Content management system  :-

java base  CMS facilitate the creation and management of digital content on website.

14] Customer  relationship management :- 

  java power CRM software to manage customer interaction and data throughout the customer lifecycle.

15 ] E-commerce platform :- 

 java is use building online shopping platforms that handle transactions , inventory management .

16] Banking Application :-

 java is use in banking software to transaction, security , account management  features.

17] Healthcare information :-

 java is use in healthcare software managing patient record, appointment scheduling and modical biling.

18] Smart Home Automation :- 

java is use software that cantrols and automates smart home devices 

 
JAVA Version History

JDK  Alpha and Beta (1995)

JDK 1.0 (23 rd jan 1996)

JDK 1.1 (19th Feb 1997)

J2SE 1.2 (8th Dec 1998)

J2SE 1.3 (6th Feb 2000)

J2SE 1.4 ( 6th Feb 2002) 

J2SE 5.0 (30th Sep 2004)

Java SE 6 (11th Dec 2006)

Java SE 7(28th July 2011)

Java SE 8 (18th Mar 2014)

Java SE 9 (21st Sep 2017)

Java SE 10 (20th Mar 2018)

Java SE 11 (September 2018)

Java SE 12(March 2019)

Java SE 13 (September 2019)

Java SE 14 (Mar 2020)

Java SE 15(September 2020)

Java SE 16 (Mar 2021)

Java SE 17 (September 2021)

Java SE 18 (March 2022)

Related  Post :-

JavaScript Course

HTML Course

PHP Course