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 do the 'c' and 'v' in argc and argv stand for?
What are the types of data structures in c?
Who had beaten up hooligan "CHAKULI" in his early college days?
Difference between goto, long jmp() and setjmp()?
for example user gives input as " 20 or 20.0 or rs 20.0 or 20.00 or rs20 and so .. on " and the output should be stored as " rs.20.00 " in a variable
name the language for writing c compiler?
Is it possible to run using programming C for Java Application?
What are c preprocessors?
disadvantages of realloc ?
Is a pointer a kind of array?
How can I increase the allowable number of simultaneously open files?
Why do u use # before include in a C Progam?