Tuesday, October 13, 2015

C++ NOMOR 1


  1. Buatlah algoritma dan pemrogram utnuk mengubah temperatur fahrenheit menjadi celcius dan reamur.
Petunjuk;
C = 5 / 9 (F – 32)
R = 4 / 9 (F – 32)
Ket:
 C = celcius
 R = reamur

             F = Faherenheit

Jawab :
#include <iostream>
#include <conio.h>
using namespace std;
main ()
{
     float NF, C, R, PC = 32, L = 5, E = 4, S = 9;
     cout<<"Fahrenheit = ";
     cin>>NF;
     C = ((L/S)*(NF-PC));
     R = ((E/S)*(NF-PC));
     cout<<"\n++++++++++++++Hasil++++++++++++++\n";
     cout<<"\nCelsius ="<<C;
     cout<<"\nReamur ="<<R;
    
     getch();
    }    

2 comments: