Skip to content

Instantly share code, notes, and snippets.

@kira924age
Last active December 26, 2015 23:59
Show Gist options
  • Save kira924age/7234996 to your computer and use it in GitHub Desktop.
Save kira924age/7234996 to your computer and use it in GitHub Desktop.
ファイルの入出力の場合
#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;
}
@kira924age
Copy link
Author

修正しました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment