Write a program for print size of int, flot, char, double data types.

PROGRAM:-


#include <stdio.h>
int main()
{
int i_size;
float f_size;
char c_size;
double d_size;
printf(“INT SIZE %d.”,sizeof(i_size));
printf(“\nFLOAT SIZE %d.”,sizeof(f_size));
printf(“\nCHAR SIZE %d.”,sizeof(c_size));
printf(“\nDOUBLE SIZE %d.”,sizeof(d_size));

}

OUTPUT :-

Program for check whether the entered age is eligible for voting or not

PROGRAM:-

Voting eligible age is 18 or greater 18 . That’s why our condition is age >= 18. If entered age is greater than or equal to 18 then condition is ture otherwise false.

OUTPUT :-

Program for check which number is greater,among given two numbers.

PROGRAM:-

/*
Program for check which number is
greater,among given two no.
*/
#include <stdio.h>
int main()
{
int no1, no2;
printf(“ENTER 1ST NUMBER:”);
scanf(“%d”,&no1);
printf(“\nENTER 2ND NUMBER:”);
scanf(“%d”,&no2);
if(no1>no2)
{
printf(“\n\v%d IS GREATER THAN %d.”,no1,no2);
}
else
{
printf(“\n\v%d IS GREATER THAN %d.”,no2,no1);
}
return 0;
}

OUTPUT:-

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 :-