109k views
5 votes
Write a single statement that prints outsideTemperature with a or - sign. End with newline. Sample output with input 103.5: 103.500000

User Psddp
by
4.8k points

1 Answer

5 votes

Answer:

Written in C Language

#include <stdio.h>

int main() {

float temp;

printf("Temperature: ");

scanf("%f",&temp);

temp-=(temp + temp);

printf("%.6f", temp);

return 0;

}

Step-by-step explanation:

This line declares temp as float

float temp;

This line prompts user for input

printf("Temperature: ");

This line gets user input

scanf("%f",&temp);

This line negates the user input

temp-=(temp + temp);

This line prints out the required output with a - sign

printf("%.6f", temp);

User Zindarod
by
4.6k points