Find Largest Number Among “n” Numbers – C Program

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

//Largest Number - FScOnline.info

int main()
{
  int i,num,n,large=0;

  printf("How many numbers: ");
  scanf("%d",&n);
  
  for(i=0; i<n; i++)
  {
    printf("\nEnter number %d: ",i+1);
    scanf("%d",&num);
    if(num>large)
    large=num;
  }

  printf("\n\nThe Largest Number is %d",large);
  
  getch();
  return 0;
}

 Output

c-program-find-largest-number-among-n-numbers

You might also like
1 Comment
  1. Scibi KS says

    what to do if 2 no. are equal and each int is stored in a variable, and u need to print the name of both variable

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. AcceptRead More