cLanguage math questions

Asked 1 weeks ago, Updated 1 weeks ago, 1 views

#include <stdio.h>

int main() {

    int A, B, C, D, E, F;

    scanf("%d%d%d\n", &A, &B, &C);
    scanf("%d%d%d", &D, &E, &F);
    printf("%d\n", ((A * 100) + (B * 10) + C) * F);
    printf("%d\n", ((A * 100) + (B * 10) + C) * (E * 10));
    printf("%d\n", ((A * 100) + (B * 10) + C) * (D * 100));
    printf("%d", ((A * 100) + (B * 10) + C) * ((D * 100) + (E * 10) + F));

    return 0;

}

https://www.acmicpc.net/problem/2588 It's Baekjun's question. I know how to use % but why can't I use the method I wrote? You must enter a string, not an integer, to activate the printf function, but I don't know why ㅠ<

c calculate 3d

2022-09-20 10:52

1 Answers

scanf %d does not only accept single-digit integers.


2022-09-20 10:52

If you have any answers or tips


© 2022 pinfo. All rights reserved.