Showing posts with label find largest num. Show all posts
Showing posts with label find largest num. Show all posts

Thursday, 15 November 2012

Write program to find largest of two numbers using function.


#include<stdio.h>
int findmax(int a,int b);
main()
{
int no1,no2,maxno;
printf("Enter two numbers : ");
scanf("%d %d",&no1,&no2);
maxno=findmax(no1,no2);
printf("Max number is %d",maxno);

}
int findmax(int x,int y)
{
if(x>y)
return x;
else
return y;
}



OUTPUT:


Enter two numbers : 5
6
Max number is 6