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 |
Find your day from your DOB?
15 Answers Accenture, Microsoft,
Is the following code legal? struct a { int x; struct a b; }
main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }
#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }
Sorting entire link list using selection sort and insertion sort and calculating their time complexity
1 Answers Infosys, Microsoft, NetApp,
To reverse an entire text file into another text file.... get d file names in cmd line
main() { int c = 5; printf("%d", main||c); } a. 1 b. 5 c. 0 d. none of the above
why do you use macros? Explain a situation where you had to incorporate macros in your proc report? use a simple instream data example with code ?
code of a program in c language that ask a number and print its decremented and incremented number.. sample output: input number : 3 321123
main() { int *j; { int i=10; j=&i; } printf("%d",*j); }
void main() { static int i=5; if(--i){ main(); printf("%d ",i); } }
can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail