-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclass2.c
66 lines (60 loc) · 1.19 KB
/
class2.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//1.wap to check weather a given no is positive or non non-positive
#include <stdio.h>
int main() {
int i;
scanf("%d", &i);
if (i <= 0) //i>0 --positive
printf("the no %d is non-positive", i);
else
printf("the no is +ve");
return 0;
}
//2.what is the out put of this problem
#include <stdio.h>
int main() {
if (5 > 4)
printf("Hello");
else
printf("Bye");
return 0;
}
//3.wap what is the output
#include <stdio.h>
int main() {
if (3 != 2)
;
//printf("Hello");
else
printf("Bye");
return 0;
}
//4.wap to check weather a given no is odd or even
#include <stdio.h>
int main() {
int i;
scanf("%d", &i);
if (i % 2 == 0) //i%2 every non zero is true and zero is false
//without using % operator (i/2*2==i)
//using bitwise operator(i&1)
printf("even %d", i);
else
printf("%d is odd", i);
return 0;
}
//5.add two no without using + operator
#include <stdio.h>
int main() {
int a, b, c;
scanf("%d %d", &a, &b);
c = a - (-b);
printf("%d is sum of a and b", c);
return 0;
}
//6.condinational operator
#include <stdio.h>
int main() {
int x = 24;
if (x > 4 ? printf("A") : printf("B"))
;
return 0;
}