$20
Introduction to Computer Programming II
Assignment 1
1. (100 pts) 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 <stdio.h
#define PI 3.141593
int main()
{
int degrees = 0;
double radians;
printf("Degrees to Radians \n");
degrees = 0;
radians = degrees*PI/180;
printf("%6i %9.6f \n", degrees, radians);
degrees = 10;
radians = degrees*PI/180;
printf("%6i %9.6f \n", degrees, radians);
.
.
.
degrees = 360;
radians = degrees*PI/180;
printf("%6i %9.6f \n", degrees, radians);
}
You can use redirection to send the output to a file.
fox01 ./assign1 prog1.c
Above command redirects the output of the program to file prog1.c instead of displaying on
the terminal window. You can test if your program works by compiling and running prog1.c
Prog1.c should produce a table of degrees and radians when executed.