1
write a single statement that prints outsidetemperature with a + or - sign. end with newline. sample output:
+103.500000
#include
int main(void {
double outsidetemperature = 103.5;
/* your solution goes here */
return 0;
}
2
write a single statement that prints outsidetemperature with 2 digits in the fraction (after the decimal point. end with a newline. sample output:
103.46
#include
int main(void {
double outsidetemperature = 103.45632;
/* your solution goes here */
return 0;

Respuesta :

Have a look at the man page for printf:

man 3 printf

Answer:

1.

printf("%lf", outsidetemperature);

2.

printf("%.2lf\n", outsidetemperature);

Explanation:

1.

The command to print is printf.

It has an argument, that is the datatype. When it is double, it is %lf.

So:

printf("%lf", outsidetemperature);

2.

Again printf. If you want m digits in the fraction, you use %.mlf. So for 2 digits is %.2lf. For a new line, you put a \n after the datatype argument. So:

printf("%.2lf\n", outsidetemperature);

ACCESS MORE