Last active
December 26, 2015 23:59
-
-
Save kira924age/7234996 to your computer and use it in GitHub Desktop.
ファイルの入出力の場合
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdioh.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
FILE *infile, *outfile; | |
int L, a, b, c, d; | |
int M, N; | |
infile = fopen("in1.txt","r"); | |
if(infile == NULL) | |
printf("\acan't open iffile\n"); | |
outfile = fopen("out1.txt","w"); | |
if (outfile == NULL) | |
printf("\acan't open outfile\n"); | |
fscanf(infile,"%d\n%d\n%d\n%d\n%d\n",&L, &a, &b, &c, &d); | |
M = a/c; | |
N = b/d; | |
if(a % c != 0) | |
M++; | |
if(b % d != 0) | |
N++; | |
if(M > N) | |
fprintf(outfile,"%d\n",L - M); | |
else | |
fprintf(outfile,"%d\n",L - N); | |
fclose(infile); | |
fclose(outfile); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
修正しました。