If Else Program

Write a C program to calculate who is younger :-

[c]

#include<stdio.h>

main()
{
float r,s,a,age;

printf("Enter Value ram are:");
scanf("%f",&r);

printf("Enter Value shaym are:");
scanf("%f",&s);

printf("Enter Value akash are:");
scanf("%f",&a);

if( r<s)
{
if(a<s)
{
printf("\n ram is youngest shyam");
}
else
{
printf("\n ram is youngest akash");
}
}
else
{
if(s<a)
{
printf("\n shyam is youngest ajay");
}
else
{
printf("\n akash is youngest shyam");
}
}
}

[/c]

Write a C program to check number is > 100 or not ?

[c]
#include<stdio.h>
main()
{

int N;
printf("Enter Number :");
scanf("%d",&N);

if(N>100)
{
printf("\n Number is Bigger Than 100");
}
else
{
printf("\n Number is Smaller than 100");
}
}

[/c]

Write a C program to Convert Days into Year.

[c]
#include<stdio.h>
#include<conio.h>
void main()

{
int A,B,C; clrscr();
printf("Enter Days:");
scanf("%d",&A);

B=A/365;

printf("\nYear is:%d",B);
C=A%365;

printf("\nDays is:%d",C); getch();
}
[/c]

Write a C program To check whether Enter a Year is Leap year or Not.

[c]
#include<stdio.h>
main()
{
int a;
printf("Enter the year:");
scanf("%d",&a);
if(a%4==0)
{printf("year is leap year");
}
else
{printf("year is not aleap year");
}

}
[/c]

Share

About the Author

Akash Padhiyar

Visit Website

There are no comments yet, add one below.

Leave a Comment

Your email address will not be published. Required fields are marked *

*

Time limit is exhausted. Please reload CAPTCHA.