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 data types?
Write a c pgm for leap year
11 Answers College School Exams Tests, IBM, TCS,
What is a pointer and how it is initialized?
What are the 32 keywords in c?
Differentiate between full, complete & perfect binary trees.
Write a program for the following series? 1 121 12321 1234321 123454321 12345654321 1234567654321 123456787654321 12345678987654321 1234567890987654321 123456789010987654321 12345678901210987654321 1234567890123210987654321 .........1234321............ ..........123454321............ ..........12345654321............ 7 8 9 0 1 Pls............?
struct node { int *a; char *b; char array[12]; }; struct node m,*n; assign the value in *a,*b,char array[12]
Write a program to show the change in position of a cursor using c
write a program to sum of its digit with using control structure or with out using loop. for ex: let the number is 25634 then answer will be=2+5+6+3+4=20
write a program to display reverse of a number using for loop?
Illustrate it summing the series 2+4+6+......to n terms using (i) while loop (ii) do-while loop
What type is sizeof?