question1 の解答 | C言語を研究

C言語を研究

C言語を研究したいと思います 目次(ここを参考に♪)→http://ameblo.jp/c-program/themeentrylist-10062017572.html

#include <stdio.h>
#include <stdlib.h>
 
#define LEN 200
 
int main()
{
int b;
        int a;
        char s[LEN];
        
        printf("a×bのaの値を入力してください!: ");
        
        if (NULL == fgets(s, LEN, stdin))
        {
                return 1;
        }
        a = atoi(s);
 
        printf("\n%d×bのbの値を入力してください: ", a);
 
        if (NULL == fgets(s, LEN, stdin))
        {
                return 1;
        }
        b = atoi(s);
 
        printf("\n%d\n", a * b);
        return 0;
}