Program for check the number is even or odd.

To check the number is even or odd No%2==0 this condition is used. If this condition is true then given number is even otherwise odd.

Above operator is called “modulus”. It will give the remainder that is left over when one number is divided by another.

Ex. 10 % 2 it will give 0 . because 10 is divisible by 2. 10 % 2 == 0 this condition is true, that’s why 10 is even number.

PROGRAM :-

OUTPUT :-

Program for get 3 numbers from user and print the numbers on output screen.

PROGRAM :-

OUTPUT :-

We can also write this code using for loop instead of using three printf and scanf . we also need an array because of for loop.

PROGRAM :-

OUTPUT :-

Program for swapping between two numbers without using third variable

Q. A = 20 and B = 40 perform swapping between A and B without using thrid variable.

Logic :-

A = A + B;

B = A – B;

A = A – B;

Answer :-

Now, we put values of a and b in above logic.

A = 20 + 40 = 60

B = 60 – 40 = 20

A = 60 – 20 = 40

after performing above operation values will be,

A = 40

B = 20

PROGRAM :-

OUTPUT :-