//largest of 3 numbers using functions
#include<stdio.h>
#include<conio.h>
int max(int a,int b)
{
if(a>b)
return(a);
else
return(b);
}
void main()
{
int x,y,z,ans1,ans2;
clrscr();
printf("enter any 3 values\n");
scanf("%d%d%d",&x,&y,&z);
ans1=max(x,y);
ans2=max(z,ans1);
printf("largest value is %d\n",ans2);
getch();
}
Functions
#include<stdio.h>
#include<conio.h>
int max(int a,int b)
{
if(a>b)
return(a);
else
return(b);
}
void main()
{
int x,y,z,ans1,ans2;
clrscr();
printf("enter any 3 values\n");
scanf("%d%d%d",&x,&y,&z);
ans1=max(x,y);
ans2=max(z,ans1);
printf("largest value is %d\n",ans2);
getch();
}
Functions
No comments:
Post a Comment