Question: This is a C language program; 1 - I need to add a header named ( Volume ) . And display the volume column, and

This is a C language program;
1- I need to add a header named (Volume). And display the volume column, and using this formula calculation, (Radius*200) to display the volume data
2- The output columns should be aligned and organized.
Below is my (orbit.csv file)
Name, Radius, (Volume),Polar_R
earth, 2.4,1140,
mars, 6.3,2334,
saturn,3.3,5719,
Neptun,2.5,4753,
Below is my Code:
#include
#include
#include
int main()
{
FILE *fp = fopen("orbit.csv","r");
int ch = getc(fp);
printf("%-30s %-11s %8s %25s
", "Name", "Radius", "Volume", "Polar_R");
while(ch !=EOF){
putchar(ch);
ch = getc(fp);
}
if (feof(fp))
printf("
End of file.");
else
printf("
Press 1 to exit");
getchar();
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!