Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- FILE *archivo;
- int num;
- char car;
- int max=-1;
- archivo=fopen("precipitaciones.txt","r");
- if(archivo==NULL){
- printf("Error, el archivo no se pudo abrir\n");
- }
- else {
- printf("El archivo se abrio correctamente\n");
- fscanf(archivo, "%d",&num);
- car=fgetc(archivo);
- while(!feof(archivo)){
- if(max<num){
- max=num;}
- fscanf(archivo, "%d",&num);
- car=fgetc(archivo);
- }
- printf("El maximo es %d",max);
- fclose(archivo);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement