-
Notifications
You must be signed in to change notification settings - Fork 0
/
pps.c
52 lines (44 loc) · 1.42 KB
/
pps.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <stdio.h>
int main()
{
int num1, num2, num3, num4;
int sum, sub, mult, mod;
float div;
int x=12, y=1;
int a=5, b=23, c;
int m=24, n=65, o=34;
int j=5, k=5, l=10, result;
int u=12, v=25;
//ARITHMATIC OPERATORS
printf("1. Input any four numbers separated by comma : ");
scanf("%d,%d,%d,%d", &num1, &num2, &num3, &num4);
sum = num1 + num2 + num3 + num4;
mult = num1 * num2 * num3 * num4;
printf("The sum of the given numbers : %d\n", sum);
printf("The product of the given numbers : %d\n\n", mult);
//INCREMENT AND DECREMENT OPERATORS
printf("2. Initial value of x = %d\n", x);
printf(" Initial value of y = %d\n\n", y);
y = ++x;
printf(" After incrementing by 1: x = %d\n", x);
printf(" y = %d\n\n", y);
y = --x;
printf(" After decrementing by 1: x = %d\n", x);
printf(" y = %d\n\n", y);
// ASSIGNMENT OPERATORS
c=a;
printf("3. c=%d\n",c);
c*=b;
printf(" c=%d\n\n",c);
// RELATIONAL OPERATORS
printf("4. %d > %d is %d\n",m,n,(m>n));
printf(" %d < %d is %d\n\n",m,o,(m<o));
// LOGICAL OPERATORS
result= (j==k) && (l>k) && (j<l);
printf("5. (j==k) && (l>k) is %d \n", result);
result= (j==k) && (l<j) && (k<l);
printf(" (j==k) && (l<j) is %d \n\n", result);
// BITWISE AND OPERATOR &
printf("6. Output = %d", u&v);
return 0;
}