954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

find larget number in an array

c program to find largest number in an array

centrinostyle
Newbie Poster
2 posts since Dec 2006
Reputation Points: 10
Solved Threads: 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.

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 
#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;
}
shivNETWORK
Newbie Poster
1 post since May 2010
Reputation Points: 9
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You