my assignment is to write a program that asks for a temperature in celcius, then spits out a value in fahrenheit, kelvin and reaumur.
This is what i have done:
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
float Temp;
float Fahr, Kelvin, Reamur;
printf(" Celcius >> ");
scanf("%f", &Temp);
Fahr = (Temp * 9/5) + 32;
Reamur = Temp * 0.8;
Kelvin = Temp + 273 ;
printf("\n Fahrenheit >> %f\n", Fahr);
printf("\n Reamur >> %f\n", Reamur);
printf("\n Kelvin >> %f\n", Kelvin);
printf("\n\n\n");
system("pause");
return 0;
}
Now the lecture want me to rewrite the code using either " ?: ". i'm not sure how this ?: actually works. Could someone please explain to me ??
Thx in advanced