C Program To Find Greatest Among Ten Numbers

The following is a C Program to check greatest among ten numbers on screen after taking input from user. Let's get started.

C Program To Find Greatest Among Ten Numbers
Find Greatest Among Ten Numbers

Overview:


Commands

scanf() function is used to obtain input and printf() function is used to print the string on the screen.
a[...] is array declaration in memory.
for() loop is used to repeat process until check condition is satisfied.

Program

#include<stdio.h>
#include<conio.h>
void main()
{
    int a[10],i,great;
    clrscr();
    printf("Enter ten values:"); 
    /*Storing ten numbers in an array*/
    for(i=0;i<10;i++)
    {
 scanf("%d",&a[i]);
    } /*Assuming a[0] is largest*/
    great=a[0];
    for(i=0;i<10;i++)
    {
 if(a[i]>great)
 {
     great=a[i];
 }
    }
    printf("great of ten numbers is %d",great);
    getch();
}


Output

Greatest Among 10 Numbers Output
Greatest Among 10 Numbers Output


All programs compiled in this post are compiled in AnDOSBox.

Books I Prefer:






I hope this article was helpful to understand C Program to check greatest among ten numbers! Comment below, if you've got any question. Head back soon for another interesting article on C Programming.

0 Comments

Post a Comment

Read Comment Policy before commenting.