#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<dir.h>
void broi (FILE *f);
void suma (FILE *f);
void maks (FILE *f);

void main ()
{
	FILE *f;
	int i;
	chdir("C:\BC31");
	f=fopen("test.txt","rt");
	clrscr();
	puts("Izbirai ne6to:");
	puts("1.suma");
	puts("2.broi");
	puts("3.maimumi");
	scanf("%d",&i);
	switch(i)
	{
		case 1 :{
		suma (f); break;}

		case 2 :{
		broi (f); break;}

		case 3 :{
		maks (f); break;}

		default : {
				puts("Error!\n");}
		getch();
		exit(0);
		fclose (f);
		getch();
	}
}

void broi (FILE *f)
{
	int i=0,a=0;
	while (!feof(f))
	{
		fscanf(f,"%d",&i);
		a++;
	}
	printf("broq e %d\n",a);
}

void suma (FILE *f)
{
	int a=0,i=0;
	while (!feof(f))
	{
		fscanf(f,"%d",&i);
		a++;
	}
	printf("sumata e %d\n", a);
}

void maks(FILE *f)
{
	int a=0,i=0;
	while (!feof(f))
	{
		fscanf(f,"%d",&i);
		if(i>a) a=i;
	}
	printf("maximuma e %d\n", a);
}
