Question Details

Write a program to find the largest number in a sequence in C

asked : 1 year, 17 days ago Computer Programming

Answers
kaneza posted an answer
1 year, 3 days ago

#include
int main()
{
int number1,number2,number3;
int largest;
printf("thank you for your efforts in programming AM FRED student in IT\n");
printf("=================================================\n");
printf("Enter the first number :");
scanf("%i",&number1);
printf("Enter the second number :");
scanf("%i",&number2);
printf("Enter the third number :");
scanf("%i",&number3);
if(number1>number2 && number1>number3)
{
;
largest=number1;
}
else if(number2>number1 && number2>number3)
{
largest=number2;
}
else
{
largest=number3;
}
printf("Hello The largest number is %i",largest);

return 0;
}
Visitor 1544597742 posted an answer
11 months, 25 days ago

#include

int main()
{
float enter_num,proc=0;

for(;;)
{
printf("Enter the number:");
scanf("%f",&enter_num);


if(enter_num == 0)
{
break;
}

if(enter_num < 0)
{
proc>enter_num;
proc=enter_num;
}

if(proc < enter_num)
{
proc = enter_num;
}

}

printf("Largest number from the above is:%.1f",proc);
return 0;
}
Post Your Own Answer