Tuesday, July 28, 2009

Write c program that reads a.b,c?

where a and b are two degrees and c increasment. the program then generate a table of conversion from degrees to radians start degrees at a and increasment by c until the degree is greater than b. recall that we say 180 degree is equal to PI radians. PI=3.14

Write c program that reads a.b,c?
Sounds like your homework.
Reply:You may contact a C helper live at website like http://ccietutorial.com/
Reply:I can't tell you exactly how to do it, because it sounds a lot like work you should be doing yourself!





Sounds like you need to use a while loop to run the program until a %26gt; b and an fprintf statement to print the table to a file.





c++ will increment c, and you can work everything else out yourself! =D
Reply:#include %26lt;stdio.h%26gt;


#define PI 3.14





int main(){


float a,b,c;


printf("a=? ");


scanf("%f",%26amp;a);


getchar();


printf("b=? ");


scanf("%f",%26amp;b);


getchar();


printf("c=? ");


scanf("%f",%26amp;c);


getchar();


if((b-a)*c%26lt;0 || c==0){


printf("\nWrong data!\nPress enter to exit!\n");


getchar();


return 0;


}


while(a%26lt;=b){


printf("%f\t%f\n",a,a*PI/180);


a+=c;


}


printf("\nPress enter to exit\n");


getchar();


return 0;


}

calling cards

No comments:

Post a Comment