74 : C Program to find max of 10 numbers using array

Check out the complete list of c-programs : C Program List    





Program to find max of 10 number inputted by user and stored in an integer array.

Logic :

//Reading 10 numbers from console and saving them in array
  for(i = 0; i<10;i++) {
     
      printf("Enter no. %d   : \n",i+1);
      scanf("%d",&arr[i]);
      
    
     
 }
// Finding the max number
 for(i = 0; i<10;i++) {
     
       if(arr[i]>=max) {
           
           max = arr[i];
       }









/*
 * 1000+ C programs + tutorials
 *
 * 
 * 74_c_program_to_find_max_of_10_numbers_inputted_using_array.c
 *  
 *  
 *
 *  Created on: Oct 25, 2014
 *  Author: Code2care.org
 */

#include 
//#include 

void main() {


//clrscr();

int arr[10];
int i;
int max=0;
 

printf("\n Enter 10 numbers : \n\n");
 
 for(i = 0; i<10;i++) {
     
      printf("Enter no. %d   : \n",i+1);
      scanf("%d",&arr[i]);
      
    
     
 }
 
 for(i = 0; i<10;i++) {
     
       if(arr[i]>=max) {
           
           max = arr[i];
       }

}
 printf("Max number : %d",max);
 
//getch();  
   
 }









The best way to learn C programming is to practice more and more of programs . Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.

BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.