Hello everyone

Codeclub,SMVDU

Revision of previous topics:

  • Increment and decrement
  • logical operators
  • If-else
  • else-if
  • while loop

              Increment  and Decrements

 

  • Post Increment   like      a++
  • Pre Increment     like      ++a             

a++;      <=>      a=a+1;

++a;       <=>      a=a+1;  

 

Logical operators

 

       &&           AND              if(cond1 && cond2){}

       ||            OR                 if(cond1 || cond2){}

        !              NOT               if(!(cond1 == cond2)){}

if (cond1)
    {
         statement1;
         statement2;
    }

else 
    {
        statement3; 
        statement4;
        statement5; 
    }

if-else

else- if

if (cond1)
    {
        statement1;
        statement2;
    }

else if(cond2)
    {
        statement3; 
        statement4;   
    }

else if(cond3)
    {
        statement5; 
        statement6;   
    }

else 
    {
        statement6; 
        statement7;   
    }

while loop


initialization;

while(condition)

{

     statement1;
     statement2;
     statement3;

     increment;

}

write a program to print numbers from 100 to 1?

write a program to find the sum of numbers between 1 to 100?

write a program to find the sum of numbers between 1 to 100 which are divisible by 2 and divisible by 3 and print the sums separately?

write a program to  take  an input from user and print its factorial?

Write a program to take an input from the user and print its multiplication table?

sample Input:

3

Output format:

3*1=3

 

3*20=60

deck

By MRITUNJAY GOUTAM