Write a program to print columns of numbers number the Squar

Write a program to print columns of numbers: number, the Square, the Square Root, and the Sine. The focus will be on printing the columns exactly as specified. INPUT/OUTPUT DESCRIPTION: The input will be: two numbers from the keyboard, a Start and End. The output will consist of words forming column headers and followed by columns of numbers lined up correctly under the column headers. ALGORITHM DEVELOPMENT: Write a comment block with your name and the assignment name. Include the three pre-processor directives that will be needed: stdio.h, stdlib.h, math.h. Write the first line and the opening brace {. Add variables as needed. Loop counters may be one letter. Other variables should be self-documenting. Use printf/scanf combinations to get your Start and End numbers. Print your column headers as shown in the Output. Use a for loop that begins with Start and ends

Solution

Here is the program:

------------------------------------------------------------------------------------------------------------------------------------------

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
int Start,End,i;
double Sine;
  
printf(\"Enter your Start Number: \");
scanf(\"%d\",&Start);
printf(\"\ \");
printf(\"Enter your End Number: \");
scanf(\"%d\",&End);
printf(\"\ \");
  
printf(\" N Squared Square Root Sine \ \");
printf(\"----- ------- ----------- --------\ \");
  
for(i=Start; i<=End; i++) {
if((double)sin(i) < 0)
printf(\" %d %.0f %.3f %0.3f\ \",i,(double)pow(i,2),(double)sqrt(i),(double)sin(i));
else
printf(\" %d %.0f %.3f %0.3f\ \",i,(double)pow(i,2),(double)sqrt(i),(double)sin(i));
};

return 0;
}

--------------------------------------------------------------------------------------------------------------------

PLEASE THUMBS UP IF SATISFIED ^_^

 Write a program to print columns of numbers: number, the Square, the Square Root, and the Sine. The focus will be on printing the columns exactly as specified.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site