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 atoi and atof in c?
Differentiate Source Codes from Object Codes
who is the founder of c
19 Answers College School Exams Tests, HP,
Explain how can I remove the trailing spaces from a string?
What is the size of empty structure in c?
What is the use of getchar() function?
Code for calculating square root without using library function, of math.h
1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
Is this program statement valid? INT = 10.50;
what r callback function?
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.