-
Notifications
You must be signed in to change notification settings - Fork 15
/
loot.c
33 lines (27 loc) · 841 Bytes
/
loot.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<stdio.h>
int main()
{
printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");
int n,i;
float c,big;
printf("\n\nEnter the number of elements you wish to find the greatest element of: ");
scanf("%d", &n);
printf("\n\nEnter %d numbers :\n", n);
printf("\n\n\t\t\tElement 1: ");
//Important step- always initialize big to the first element
scanf("%f", &big);
for(i = 2; i <= n; i++)
{
printf("\n\t\t\tElement %d : ", i);
scanf("%f", &c);
/*
if input number is larger than the
current largest number
*/
if(big < c)
big = c; // update big to the larger value
}
printf("\n\n\nThe largest of the %d numbers is %f ", n, big);
printf("\n\n\n\n\t\t\tCoding is Fun !\n\n\n");
return 0;
}