The below program calculates the largest no among the no entered but it just calculates as user inputs them. This can be used with files and as you move ahead in file you can store the max and the min value in a variable when parsing the file. Code: #include<stdio.h> int largest(int,int); void main() { int n,m,i; printf("Go on entering numbers\n"); scanf("%d",&n); for(i=1;i<=10;i++) { scanf("%d",&m); m=largest(n,m); printf("%d\t",m); /*prints the largest of the number inputed till now*/ n=m; } } int largest(int n,int m) { if(n>m) m=n; return(m); }