Key Features

Experienced Teachers
Smart Classes
Regular Test
Study Material

Well qualified teachers with industrial experience.

To visualise or understand topics very easly.

We are organizing online and offline regular test.

We are providing prescribed study material.

Friday, October 30, 2020

Question : Write a C Program to find greatest in 3 numbers.

 

Question :  Write a C Program to find greatest in 3 numbers.

/*
Write a C Program to find greatest in 3 numbers.
*/
 
#include <stdio.h>
int main()
{
                int num1,num2,num3;
               //Ask user to input any three integer numbers
               printf("\n Enter value of num1, num2 and num3:");
               //Store input values in variables for comparsion
               scanf("%d %d %d",&num1,&num2,&num3);
                if((num1>num2)&&(num1>num3))
               {
                               printf("\n Number1 is greatest");
               }
               else if((num2>num3)&&(num2>num1))
               {     
                               printf("\n Number2 is greatest");
               }
               else
                {
                               printf("\n Number3 is greatest");
               }
               return (0);
}
 
OUTPUT :
Enter value of num1, num2 and num3: 15  200  101
Number2 is greatest


Thank you very much for reading carefully, if you have any other questions, you can share it with us through comments, if this information was important to you, please let us know through comments.

Please do comment and share.
Thank You.

No comments:

Post a Comment