3
Contributors
2
Replies
7
Views
10 Years
Discussion Span
Last Post by shivNETWORK
0

c program to find largest number in an array

what about it? have you tried to do this? If you have, then post your code so that people here can help you with your questions.

-3
#include <stdio.h>

int main(){
int num[5] = {2, 90, 102, 13, -76};
int largest = num[0], i = 0;
for(i = 0; i < 5; i++){
if(num[i] > largest){
largest = num[i];
}
}
printf("Largest number is %d\n", largest);
return 0;
}

Edited by WaltP: Added CODE Tags

Votes + Comments
Don't bump old threads
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.