Error when displaying int value

Asked

Viewed 31 times

1

Hello, I’m new to the C language and I’d like to know how to fix this code. When executing the code below, I get the following error message in row 22 and column 13:

[Error] invalid Conversion from 'int' to 'const char*' [-fpermissive]

Code:

include <stdio.h>

int main(void){


    int resul;

    int a;
    int b;

    printf("Digite o valor de A: ");
    scanf("%d", &a);

    printf("Digite o valor de B: ");
    scanf("%d", &b);


    resul = b;
    b = a;
    a = resul;

    printf(a);

    printf(b);

    return 0;
}
  • 2

    The print function requires you to enter a format string. Of type: printf("a: %d\n", a);.

  • What is expected as output?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.