How to write a program to receive an integer & find its octal equivalent
by using for loop?
Answer Posted / neelkamal
#include"neel.h" // all header file store in neel.h
void rev(int *x) //declaration and body of function
{
int i,t, end=0,a,b;
clrscr();
while(x[end]!=NULL)
end++;
end=end-1;
for(i=0;i<=end/2;i++)
{
t=x[i];
x[i]=x[end];
x[end]=t;
end=end--;
}
i=0;
while(x[i]!=NULL)
{
printf(" %d",x[i]);
i++;
}
}
void main()
{
int x[20];
int n,i=0;
printf("\nenter any int to convert to octal:");
scanf("%d",&n);
for(i=0;i<=20;i++)
{
x[i]=n%8;
n=(n-x[i])/8;
}
rev(x);
getch();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Why do some versions of toupper act strangely if given an upper-case letter?
What is clrscr in c?
Is anything faster than c?
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
What is d'n in c?
What is array of structure in c programming?
What is #include stdio h and #include conio h?
What are near, far and huge pointers?
How can I make sure that my program is the only one accessing a file?
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..
What is pointer in c?
Write a program for Overriding.
What library is sizeof in c?
What is the use of linkage in c language?