Lesson 2.
This commit is contained in:
19
02/Experiment1-2.c
Normal file
19
02/Experiment1-2.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user