Hello everyone !

Codeclub,SMVDU

                          else if() ladder


if(cond1)
{
statement1;
}

else if(cond2)
{
statement2;
}

else if(cond3)
{
statement3;
}

else
{
statement4;
}

Write a program to input marks of five subjects Physics, Chemistry, Biology, Mathematics and Computer. Calculate percentage and grade according to following:
Percentage >= 90% : Grade A
Percentage >= 80% : Grade B
Percentage >= 70% : Grade C
Percentage >= 60% : Grade D
Percentage >= 40% : Grade E
Percentage < 40% : Grade F

                          nested if-else()

if(cond1)
    {
        if(cond2)
            {
                statement1;
            }
        
        else
            {
                statement3;
            }
    }

else
    {
         statement4;
    }

Write a program to check whether a student is from non-medical or medical and he is a dropper student or not?

Input format:

Take two input from user where first input is either 'b' or 'm' and second is 'y' or 'n'.

where b for biology , m for math , y for dropper , n for non-dropper.

Output format:

He is dropper/non-dropper and medical/non-medical student.

Sample input:

b y

Sample output:

He is dropper and medical student.

Write a program to take an input from user and find is it divisible by 3 or divisible by both 3 and 6 or not divisible by 3?

Loop

  • print the numbers between 1 to 10.

Subtitle

while loop

A while loop is used for repeatedly executions of some statements till the condition of while loop is true

 


initialization;

while(condition)

{

     statements;

     increment;

}
Made with Slides.com