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
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
Is javascript written in c?
Can you define which header file to include at compile time?
What is spark map function?
How can you draw circles in C?
How old is c programming language?
how many key words availabel in c a) 28 b) 31 c) 32
Why static is used in c?
Is c compiled or interpreted?
Write a program to reverse a linked list in c.
Explain what is the difference between functions getch() and getche()?
Explain 'far' and 'near' pointers in c.
What are the features of the c language?
What does %d do?
the 'sizeof' operator reported a larger size than the calculated size for a structure type. What could be the reason?