-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclass4.c
88 lines (80 loc) · 1.14 KB
/
class4.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include <stdio.h>
int main() {
int i, j;
for (i = 1; i <= 5; i++)
for (j = i + 1; j <= 4; j++)
printf("%d", 2 * j - 1);
return 0;
}
#include <stdio.h>
int main() {
int i = 5, j = 1;
while (i) {
j = i * j;
i--;
}
printf("%d %d", i, j);
return 0;
}
#include <stdio.h>
int main() {
int x = 1, y = 10;
while (x < y) {
x++;
y--;
}
printf("%d %d", x, y);
return 0;
}
#include <stdio.h>
int main() {
int i = 2, x = 36;
while (x > 1) {
while (x % i == 0) {
x /= i; //x=x/i;
printf("%d", i);
}
i++;
}
return 0;
}
#include <stdio.h>
int main() {
int x = (1, 2, 3);
while (x) {
printf("%d", x);
x--;
}
return 0;
}
#include <stdio.h>
int main() {
int x;
x = 1, 2, 3;
while (x) {
printf("%d", x);
x--;
}
return 0;
}
//wap to calculate sum of n odd natural no
#include <stdio.h>
int main() {
int i, n;
int s = 0;
printf("enter a no");
scanf("%d", &n);
for (i = 1; i <= n; i++)
s = s + 2 * i - 1;
{
printf("%d", s);
}
return 0;
}
#include <stdio.h>
int main() {
int x = 8;
for (; x; x >>= 1)
printf("%d ", x);
return 0;
}