✔ Cpp Program ⚡ How to convert Fahrenheit to Celsius with C++?🔥

#include<iostream>
#include<iomanip>
using namespace std;
void calcCelsius(float fahrenheit, float *celsius){
  (*celsius) = ((5.0f/9.0f) * (fahrenheit - 32.0f));
}
int main(){
  float fahrenheit, celsius;
  cout << "Enter fahrenheit: ";
  cin >> fahrenheit;
  calcCelsius(fahrenheit, &celsius);
  cout << "Celsius: " << setprecision(0) << fixed << celsius << endl;
}

Comments

Popular posts from this blog