When I compile this I get the "too few arguments for format for both of my printf statements following my equations. Why is this? and as well it says there is an error in the first equation I have created.
Code:
#include <stdio.h> #include <math.h> int main(void) { double escape; double radius; double mass; double grav; int num; int cont; do { printf("Please select 1. Select 2: "); scanf("%d",&num); }while((num!=1)||(num!=2)); if(num==2) do { printf("Please enter the mass of the planet: "); scanf("%lf", &mass); printf("Please enter the radius of the planet: "); scanf("%lf", &radius); escape=sqrt((2*pow(6.67428*10,-11)*mass)/radius)); printf("The escape velocity of this planet will be: %.5f\n"); grav=(((mass/pow(5.9736*10,24))/(radius/6371000))); printf("The gravity factor of this planet is: %.5f\n"); printf("Plese select 1 to calculate for another planet: "); scanf("%d", &cont); }while(cont==1); return(0); }
Comment