Computer Science, asked by sindusarode7461, 1 year ago

Write a program in c find greatest number among three number

Answers

Answered by syedtalha777
3
The program output is also shown below.

* C program to find the biggest of three numbers.

int num1, num2, num3;

printf("Enter the values of num1, num2 and num3\n");

scanf("%d %d %d", &num1, &num2, &num3);

printf("num1 = %d\tnum2 = %d\tnum3 = %d\n", num1, num2, num3);

if (num1 > num2)

{

if (num1 > num3)

Answered by Anonymous
7
Hey there!

--------

Q. Write a program in C to find greatest number among three number.

Answer -:

Note -:The largest number among three numbers is found using multiple ways, but i am giving only one example.

/*
* C program to find the greatest of three numbers
*/
#include<stdio.h>
#include<conio.h>

void main()
{
int num1, num2, num3;

printf("Enter the values of num1, num2 and num3\n");
scanf("%d %d %d", &num1, &num2, &num3);
printf("num1 = %d\tnum2 = %d\tnum3 = %d\n", num1, num2, num3);
if (num1 > num2)
{
if (num1 > num3)
{
printf("num1 is the greatest among three \n");
}
else
{
printf("num3 is the greatest among three \n");
}
}
else if (num2 > num3)
printf("num2 is the greatest among three \n");
else
printf("num3 is the greatest among three \n");
}
return 0;
}

OUTPUT

Enter the values of num1, num2 and num3
19
29
49
num1 = 19 num2 = 29 num3 = 49
num3 is the greatest among three
Similar questions