Computer Science, asked by subhrochakraborty, 2 months ago

write an algorithm to take input 10 numbers and find the greatest number​

Answers

Answered by nishuarya2000
0

Answer:

#include <stdio.h>

int main()

{

int a[10];

int i;

int greatest;

printf("Enter ten values:");

for (i = 0; i < 10; i++)

{

scanf("%d", &a[i]);

}

greatest = a[0];

for (i = 0; i < 10; i++) {

if (a[i] > greatest) {

greatest = a[i];

}

}

printf("

Greatest of ten numbers is %d", greatest);

return 0;

}

Explanation:

loop is executed until the end of the array 'a[]';.

for(i=0; i<10; i++){

if(a[i]>greatest){

greatest= a[i];

}

}

Similar questions