Monday, April 12, 2021

69. Program to find largest number of 'n' numbers.

69. Program to find largest number of 'n' numbers.

#include<stdio.h>
#include<conio.h>
void main()
{
    int n, num, i;
    int big;
    clrscr();
    printf("Enter total numbers : ");
    scanf("%d", &n);

    printf("Number %d : ", 1);
    scanf("%d", &big);

    for (i = 2; i <= n; i++)
    {
        printf("Number %d : ", i);
        scanf("%d", &num);

        if (big < num)
            big = num;
    }

    printf("Largest number is : %d", big);
    getch();
}

No comments: