Write a C program to get three integers from user and find the largest number among three numbers

 TASK-

Write a C program to get three integers from user and find the largest number among three numbers.



CODE:

#include<stdio.h>
int main(){


int one,two,three,max;

printf("Enter three numbers: \n");

printf("Enter 1st number: ");   //asking 1st number
scanf("%d",&one);

printf("\nEnter 2nd number: ");   //asking 2nd number
scanf("%d",&two);

printf("Enter 3rd number: ");     //asking 3rd number
scanf("%d",&three);

//condition for max

if (one>two && one>three)
max=one;
else if (two>one&&two>three)
max=two;
else

max=three;

printf("\nGreater number is %d",max);

getchar();
return 0;
}

Expected Output:



NEED WORK PRODUCE WORK

My name is Abdul Rehman I am from Pakistan. I am doing BS in Computer and information sciences. Currently, I am creating these blogs to help students of computer sciences all over the world..

Post a Comment (0)
Previous Post Next Post