How to write a program to receive an integer & find its octal equivalent
by using for loop?
Answer / 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 |
What is bash c?
Why cant I open a file by its explicit path?
i want to job in your company, so how it will be possible.
what will happen if you free a pointer twice after allocating memory dynamically ?
What is the purpose of 'register' keyword in c language?
which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above
how many key words availabel in c a) 28 b) 31 c) 32
Is main a keyword in c?
What are the 5 organizational structures?
Do you know the use of fflush() function?
What is the use of #define preprocessor in c?
Why do some versions of toupper act strangely if given an upper-case letter?