-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
54 lines (43 loc) · 1022 Bytes
/
Copy pathmain.c
File metadata and controls
54 lines (43 loc) · 1022 Bytes
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
#include <stdio.h>
#include <math.h>
// LIST OF FUNCTIONS:
// 1. Power of 2
// 2. Prime Numbers
// 3. Roman Letters
// 4. Day of the Week
// 5. Calendar
// 6. Memory-Swap
// 7. Blobk Structure
// 8. Swap Macro using Block Structure
// 9. printf with %b
#define ISPOWEROF2( n ) ( ! (n & ( n - 1)))
typedef int BOOLEAN;
#define TRUE 1
#define FALSE 0
#define SWAP(a, b) (a ^= b ^= a ^= b)
BOOLEAN IsPrime(int n) /* returns TRUE if prine and FALSE otherwise */
{
}
int main(void) {
/*
int n = 3;
do {
if(ISPOWEROF2(n)) printf("%d is a power of 2\n", n);
else printf("%d is NOT a power of 2\n", n);
}
while( (n = n << 1) < pow(2,10));
n = 2;
do {
if(ISPOWEROF2(n)) printf("%d is a power of 2\n", n);
else printf("%d is NOT a power of 2\n", n);
}
while( (n = n << 1) < pow(2,10));
*/
/*
int a = 1, b = 2;
printf("Originally:\n\t a is --> %d ; b is --> %d\n", a, b );
SWAP(a, b);
printf("After swapping:\n\t a is --> %d ; b is --> %d", a, b);
*/
return 0;
}