Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How do you do dynamic memory allocation in C applications?

1045


How do you list files in a directory?

1076


What is a macro, and explain how do you use it?

1016


What is the difference between text and binary modes?

1126


Write a program to check armstrong number in c?

1082


How can I avoid the abort, retry, fail messages?

1085


List some applications of c programming language?

901


Explain the difference between getch() and getche() in c?

937


What is the usage of the pointer in c?

1043


Not all reserved words are written in lowercase. TRUE or FALSE?

1181


Write a code to remove duplicates in a string.

984


Explain can you assign a different address to an array tag?

1014


What is a constant?

995


why wipro wase

2249


The file stdio.h, what does it contain?

1116