Write a C program to find greatest number among three numbers.
OUPUT:
enter three number 3 4 5
5 is greater than 3 and 4
#include<stdio.h>
void check(int,int,int);
int main()
{
int a,b,c;
printf("enter three number ");
scanf("%d%d%d",&a,&b,&c);
check(a,b,c);
}
void check(int a,int b,int c)
{
if(a>b&&a>c)
{
printf("%d is greater than %d and %d",a,b,c);
}else if(b>c&&b>a)
{
printf("%d is greater than %d and %d",b,c,a);
}
else
{
printf("%d is greater than %d and %d",c,a,b);
}
}
Structures in Cis a user-defined data type available in C that allows to combining of data items of different kinds. Structures are used to represent a record.
Defining a structure:To define astructure, you must use thestructstatement. The struct statement defines a newdata type, with more than or equal to one member. The format of the struct statement is as follows:
struct [structure name] { member definition; member definition; ... member definition; }; (OR) struct [structure name] { member...