Please help me this problem and more details thank you Write a C program that pr
ID: 3665974 • Letter: P
Question
Please help me this problem and more details thank you
Write a C program that prints the numbers from 1 to 10 and their squares separated by a tab. To receive full points your program MUST use the double datatype to store the value and value squared, use the pow function found in math.h to calculate the squared value, print out the floating point values with a precision of 0 as shown below, and separate the value and value squared with a horizontal tab by using the "|t" escape sequence. Sample output without decimals would look like:Explanation / Answer
convert.c
#include <stdio.h>
int main(void) {
printf("%s","Please select from the menu below: ");
printf("%s","Press 1 to convert kilometers to miles ");
printf("%s","Press 2 to convert miles to kilometers ");
//Taking the input for user's choice
int choice=0;
scanf("%d",&choice);
//kilometers to miles
if(choice==1)
{
double kilometers=0.0;
printf("%s","Please enter the length in kilometers ");
scanf("%lf",&kilometers);
double miles=kilometers/1.61;
printf("%f %s %f %s",kilometers,"kilometers is",miles,"miles ");
}
//miles to kilometers
else if(choice==2)
{
double miles=0.0;
printf("%s","Please enter the length in miles ");
scanf("%lf",&miles);
double kilometers=miles*1.61;
printf("%f %s %f %s",miles,"miles is",kilometers,"kilometers ");
}
//invalid choice
else
{
printf("%s","invalid option selected ");
}
return 0;
}