#include<stdio.h>
int main()
{
int a = 0, b = 0, c = 0, d = 0, e = 1;
for (; e == 1;)
{
printf("please choose your mathematical operations(add(1),multiply(2),modulus(3))\n");
scanf_s("%d", &a);
printf("please enter two nums\n");
scanf_s("%d%d", &b, &c);
switch (a)
{
case 1:
d = b + c;
printf("the fir num add the sed num is equal to %d\n", d);
break;
case 2:
d = b * c;
printf("the first num multiply sed num is equal to %d\n", d);
break;
case 3:
d = b % c;
printf("the fir num modulus the sed num is equal to %d\n", d);
}
printf("are you want to calutrate again(Y/1,N/0)\n");
scanf_s("%d", &e);
}
}
随手写的,没啥意思
#include<stdio.h>
int main()
{
int a = 0, b = 0, c = 0;
printf("please choose the side of a square\n");
scanf_s("%d", &a);
b = a;
c = a;
for (; a != 0; a--)
{
for (; b != 0; b--)
{
printf("* ");
}
printf("\n");
b = c;
}
}