Q. Write a C program to print the following binary geometric number pyramid as:
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
or
7
14 15
28 29 30 31
56 57 58 59 60 61 62 63
[How to create : in above pyramid design, left hand side vertical left align elements are as 1, 2, 3, 4, 8 as geometric sequence numbers. And each these number increase to +1, till equal the binary number as 1, 2, 4, 8, 16 and so on.
]
Ans.
/*c program for generating geometric sequence of any number*/
#include<stdio.h>
int main()
{
int num,n,r,c,rows,x=1;
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
or
7
14 15
28 29 30 31
56 57 58 59 60 61 62 63
[How to create : in above pyramid design, left hand side vertical left align elements are as 1, 2, 3, 4, 8 as geometric sequence numbers. And each these number increase to +1, till equal the binary number as 1, 2, 4, 8, 16 and so on.
]
Ans.
/*c program for generating geometric sequence of any number*/
#include<stdio.h>
int main()
{
int num,n,r,c,rows,x=1;