Write a program to input 6 numbers. After each number is input, print the biggest of the numbers entered so far.
Sample Run
Enter a number: 1
Largest: 1
Enter a number: 3
Largest: 3
Enter a number: 4
Largest: 4
Enter a number: 9
Largest: 9
Enter a number: 3
Largest: 9
Enter a number: 5
Largest: 9
Answers
Answered by
1
Answer:
Explanation:
#include <stdio.h>
int main()
{
int array[6], i, largest;
printf("\n Enter elements of the array: ");
for (i = 0; i < 6; i++)
scanf("%d", &array[i]);
largest = array[0];
for (i = 1; i < 6; i++)
{
if ( array[i]> largest)
largest = array[i];
}
printf("\n largest no is : %d", largest);
return 0;
Similar questions
CBSE BOARD X,
5 hours ago
Math,
5 hours ago
Computer Science,
9 hours ago
Math,
8 months ago
English,
8 months ago