function to find maximum number in c

C, C++, etc Programing examples. Post as many you can. Test the programs and discuss about the output of the programes.
Forum rules
Please Discuss & post only about the programes and its Output

function to find maximum number in c

Postby kantisuthar » Sat Apr 16, 2011 2:54 pm

#include<stdio.h>
#include<conio.h>
void max(int,int);
void main()
{
int a,b;
clrscr();
printf("\n\t Enter first number :");
scanf("%d",&a);
printf("\n\t Enter second number :");
scanf("%d",&b);
max(a,b);
getch();
}
void max(int no1,int no2)
{
int ans;
if(no1>no2)
{
ans=no1;
}
else
{
ans=no2;
}
printf("\n\t The maximum numbre is %d",ans);
}
kantisuthar
Registered User
 
Posts: 6
Joined: Thu Apr 14, 2011 7:22 pm
membership: Associate Member of The Institution of Engineers (India)- AMIE

ad
 

Return to Computer Notes : Some Sample Programs

Who is online

Users browsing this forum: No registered users and 0 guests