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 |
int main(){ float f=8.0; if(f==8.0) printf("good"); else printf("bad"); } what is the answere and explain it?
What is bash c?
Question 1: You want to conduct a survey within your classroom, on the quality of canteen’s food. You ask each of your class fellows to rank the quality of food between 1 and 5 (1 representing excellent quality and 5 representing worst quality). During the survey, you make a list containing the roll# of student and the opinion given by that student. The list can be as follow Roll # Opinion 234 1 235 1 236 5 237 1 238 2 239 3 240 5 241 5 242 1 To get the results of the survey, you need to determine the frequency of each opinion value. The frequency of an opinion is determined by counting the number of students giving that opinion. For example, for the above list the frequency of opinion value 1 is 4 and frequency of opinion value 4 is 0. After getting the frequency of each opinion, you can easily judge about the quality of the food by seeing through the frequency of each opinion. You need to develop a program to calculate the results of this survey. The program inputs the opinion of 50 students and counts the frequency of each opinion. It then displays a report showing the frequency of each opinion. Sample output: Opinion Frequency Remarks 1 5 Excellent 2 10 Good 3 15 Normal 4 10 Bad 5 10 Really bad
What is the benefit of using const for declaring constants?
What are the __date__ and __time__ preprocessor commands?
What are the advantages of using macro in c language?
Are enumerations really portable?
What is the benefit of using #define to declare a constant?
print a "hello" word without using printf n puts in c language
What is a function in c?
Do variables need to be initialized?
what is event driven software and what is procedural driven software?