If age of Ram, Shyam,Ajay are input through the key board , Write a program to determine the youngest of the three.
// program youngest of three .
# include<stdio.h>
int main(){
int ram,shyam,ajay;
printf("Enter the age of Ram ,Shyam and Ajay:\n");
scanf("%d%d%d",&ram,­am,&ajay);
if(ram<shyam)
{
if(ram<ajay)
{
printf("Ram is youngest");
}
}
if(shyam<ram)
{
if(shyam<ajay)
{
printf("Shyam is youngest");
}
}
if(ajay<ram)
{
if(ajay<shyam)
{
printf("Ajay is youngest");
}
}
if(ram==shyam||shyam==ajay||ajay==ram||ram==shyam==ajay)
{
printf("Their should same age !");
}
return 0;
}
/*output*/
Enter the age of Ram ,Shyam and Ajay:
45
32
51
Shyam is youngest
Comments
Post a Comment