2. 基礎級-2-(1-5)題解

基礎級-2-(1-5)題解:

================================

2-1

--------------------------------

#include<stdio.h>

int main()

{

int x, y;

scanf("%d", &x);

y = x * 2;

printf("%d", y);

return 0;

}

-----------------------------------------------------

2-2

-----------------------------------------------------

#include <stdio.h>

int main()

{

short int x;

scanf("%d",&x);

printf("%d\n",x);

printf("%d\n",x*x);

printf("%d",x*x*x);

return 0;

}

-----------------------------------------------------

2-3

-----------------------------------------------------

#include <stdio.h>

int main()

{

short int x,y;

scanf("%d",&x);

scanf("%d",&y);

printf("%d",3*x*y);

return 0;

}

-----------------------------------------------------

2-4

-----------------------------------------------------

#include<stdio.h>

int main()

{

int x, y, a;

scanf("%d\n", &x);

scanf("%d\n", &y);

a = x * y * (-1);

printf("%d", a);

return 0;

}

-----------------------------------------------------

2-5

-----------------------------------------------------

#include <stdio.h>

main()

{

int x,y,z;

scanf("%d",&x);

scanf("%d",&y);

scanf("%d",&z);

printf("%d\n",(x*y)/z);

printf("%d\n",(x*y)%z);

return 0;

}

-----------------------------------------------------