Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

A C Program To Find The Greatest Number In Array

array single dimentional array programming in c numbers tutorial program dev c++ c++ drcaos

  • Please log in to reply
No replies to this topic

#1 enggdrcaos

enggdrcaos

    CC Lurker

  • New Member
  • Pip
  • 8 posts
  • Programming Language:C, Java, C++, Objective-C

Posted 04 June 2012 - 02:52 AM

We have made a video explaining how to write a C program to find the greatest element in an array. We have explained the entire program and also tested it all in the same video.

http://www.youtube.com/watch?v=skDv2j7PKc8

Program
---------------------------------------------------------------------------


#include<stdio.h>
#include<conio.h>

int main (void){
	
	int arr[5];
	int i;
	int greatest;
	
	printf("Enter The numbers");
	
	for(i=0;i<=4;i++){
					  scanf("%d",&arr[i]);
					  }
	greatest=arr[0];
	
	for(i=0;i<=4;i++){
					  if(arr[i]>greatest){
										  greatest=arr[i];
										  }
										  }
   printf("Ther greatest element is %d",greatest);									  
	getch();
	
}
-------------------------------------------------------------------------

Dont forget to comment.
  • 0





Also tagged with one or more of these keywords: array, single dimentional array, programming in c, numbers, tutorial, program, dev c++, c++, drcaos

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download