Write a program using a loop that outputs the following program with no loops to
ID: 3785005 • Letter: W
Question
Write a program using a loop that outputs the following program with no loops to produce a table of angles in degrees and radians in increments of 10 degrees. The output of your program should be the below program where is also replaced with code. Name your program assign1.c and write your program to print the output on the screen. #include #define PI 3.141593 integral main () {integral degrees = 0; double radians; printf ("Degrees to radians "); degrees = 0; radians = degrees *PI/180; printf("%6i %9.6f ". degrees, radians); degrees = 0; double radians; printf ("Degrees to radians "); degrees = 10; radians = degrees *PI/180; printf("%6i %9.6f ". degrees, radians); ... degrees = 0; double radians; printf ("Degrees to radians "); degrees = 0; radians = degrees *PI/180; printf("%6i %9.6f ". degrees, radians);} You can use redirection to send the output to a file. Fox 01>, assign1 > prog1, cExplanation / Answer
#include <stdio.h>
#include<string.h>
#define pi 3.141593
int main(void) {
int i;
int degrees=0;
double radians;
printf("radians to degree ");
while(degrees<=360){
radians=(degrees*pi)/180;
printf("%6i %9.6f ",degrees,radians);
degrees=degrees+10;
}
return 0;
}
output:
radians to degree
0 0.000000
10 0.174533
20 0.349066
30 0.523599
40 0.698132
50 0.872665
60 1.047198
70 1.221731
80 1.396264
90 1.570796
100 1.745329
110 1.919862
120 2.094395
130 2.268928
140 2.443461
150 2.617994
160 2.792527
170 2.967060
180 3.141593
190 3.316126
200 3.490659
210 3.665192
220 3.839725
230 4.014258
240 4.188791
250 4.363324
260 4.537857
270 4.712389
280 4.886922
290 5.061455
300 5.235988
310 5.410521
320 5.585054
330 5.759587
340 5.934120
350 6.108653
360 6.283186
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.