Tuesday, February 10, 2015

Largest of n numbers

/* Program to find the largest of n numbers */ #include <stdio.h> int main() { int n, num, i; int big; printf("Enter the values of n: "); 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(); return 0; }

Share

& Comment

0 comments:

Post a Comment

 

Copyright © 2015 Code Fervor™ is a registered trademark.

Designed by Templateism By Naman Kumar