Files
BasicsOfComputerSoftwareEng…/02/Experiment1-2.c
2022-09-23 17:43:59 +08:00

19 lines
594 B
C

#include <stdio.h>
int main() {
int x1, x2; // Define two integers; uses 4 bytes each.
unsigned y; // Define an unsigned integer; uses 4 bytes.
char c1, c2; // Define two charater; uses 1 bytes each.
x1 = 65535;
x2 = x1 + 5;
printf("Enter y: ");
scanf("%u", &y); // Read y from user input
c1 = 97;
c2 = 'A';
c2 = c2 + 32; //Change the value of c2, using c2 itself.
printf("x1=%d\n", x1);
printf("x2=%d\n",x2);
printf("y=%u\n",(y+15)); // Calculate y + 15, and then output it
printf("c1=%c\n",c1);
printf("c2=%c\n",c2);
return 0;
}