c program to find largest number in an array

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.

#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;
}
commented: Don't bump old threads -1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.