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 |
Is it possible to run a c program without using main?If yes HOW??
Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.
write a program in C to swap two variables
a<<1 is equivalent to a) multiplying by 2 b) dividing by 2 c) adding 2 d)none of the above
what is difference between array of characters and string
sir i wanted to know how we wap in c to add numbers without using arithmetic operator in which digits are entered by user?
totally how much header files r in c language
Why flag is used in c?
Which of the following data structures is on average the fastest for retrieving data: 1) Binary Tree 2) Hash Table 3) Stack
what is an inline fuction??
What is the difference between #include and #include 'file' ?
What does do in c?