Computer Science, asked by Muskangupta480, 1 year ago

Write a program to find the greatest of three numbers


Kartik08989: hi
Kartik08989: muskan

Answers

Answered by Dhruv245101
1

/*

* C program to find the biggest of three numbers

*/

#include <stdio.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");

}


Kartik08989: hi
Dhruv245101: hlo
Answered by cyrusbishop
0

C program is the main program to find the greatest 3 numbers.

In orders - First have to take the three numbers, then have to check the first number because first number should be less than second and third numbers, then again have to check the second and third numbers also, then final which will be the among three numbers, it will be the greatest three number.

num1, num2, num3

Scan num1, num2, num3

If num2>num3

Second scan num2>num3

So, num2 is the greatest three number among the three numbers.

Similar questions