Write a program to receive an integer and find it's octal
equivalent.
How can i do with using while loop.
Answers were Sorted based on User's Feedback
Answer / mithun shrivastav
#include<stdio.h>
void main()
{
int n,sum = 0,rev = 0;
print("\nEnter an Integer No. : ");
scanf("%d", &n);
while(n>0)
{
sum = sum * 10 + n%8;
n = n/8;
}
while(sum > 0)
{
rev = rev*10 + sum%10;
sum = sum/10;
}
printf("Octal Equivalent = ", rev);
getch();
}
Is This Answer Correct ? | 19 Yes | 16 No |
main() { { unsigned int bit=256; printf("%d", bit); } { unsigned int bit=512; printf("%d", bit); } } a. 256, 256 b. 512, 512 c. 256, 512 d. Compile error
main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a. Runtime error. b. I am OK c. Compile error d. I am O
main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }
main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\n", 1L << i); } } a. 5, 4, 3, 2, 1 b. 0, 1, 2, 3, 4 c. 0, 1, 2, 4, 8 d. 1, 2, 4, 8, 16
main( ) { int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf(ā%u %u %u %d \nā,a,*a,**a,***a); printf(ā%u %u %u %d \nā,a+1,*a+1,**a+1,***a+1); }
main() { int i =10, j = 20; clrscr(); printf("%d, %d, ", j-- , --i); printf("%d, %d ", j++ , ++i); } a. 20, 10, 20, 10 b. 20, 9, 20, 10 c. 20, 9, 19, 10 d. 19, 9, 20, 10
There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.
How we print the table of 3 using for loop in c programing?
Write a routine that prints out a 2-D array in spiral order
main() { int i=5; printf("%d",++i++); }
void main() { void *v; int integer=2; int *i=&integer; v=i; printf("%d",(int*)*v); }
main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }