complete c7ex1

This commit is contained in:
Akbar Rahman 2023-10-03 11:56:22 +01:00
parent 1748a31acd
commit 242826ea92
Signed by: alvierahman90
GPG Key ID: 20609519444A1269

28
C6/ex1.c Normal file
View File

@ -0,0 +1,28 @@
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
// Declare some variables
int a, b;
// Note: Order of a,b indicates the order in which operations are carried out on execution
// Increment operators
b = 3;
printf("a=%d b=%d\n", a, b);
a = ++b; // b is now 4, a is also 4
printf("a=%d b=%d\n", a, b);
a = b++; // a is 4, b is now 5,
printf("a=%d b=%d\n", a, b);
// Decrement operators (reset a back to 3)
b = 3;
printf("a=%d b=%d\n", a, b);
a = b--; // a is 3, b is now 2
printf("a=%d b=%d\n", a, b);
a = --b; // b is now 1, a is also 1
printf("a=%d b=%d\n", a, b);
return 0; // Exit from main
}