Thursday 3 May 2012

C program to accept three numbers and print largest of the three


#include<stdio.h>
#include<conio.h>


void main()
{
int x,y,z,max;
clrscr(); //to clear the screen

printf("Enter three numbers:");
scanf("%d%d%d",&x,&y,&z);


max=x;
if(y>max&&y>z)
max=y;
else
if(z>max&&z>y)
max=z;
printf("\nLargest number is %d",max);
getch(); //to stop the screen
}


Related Posts Plugin for WordPress, Blogger...