#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int celcius;
float reamur,fahreinheit;
printf("Masukan Celcius : ");
scanf("%i",&celcius);
reamur= (float)4/5 * celcius;
printf("Hasil perhitungan reamur = %f \n", reamur);
fahreinheit= 9/5 * celcius + 32;
printf("Hasil perhitungan fahreinheit = %f \n", fahreinheit);
system("PAUSE");
return EXIT_SUCCESS;
}
*ganjil atau genap
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int a;
printf("masukan nilai a : ");
scanf("%i",&a);
if(a % 2==1)
{
printf("ganjil \n");
}
else
{
printf("genap \n");
}
system("PAUSE");
return EXIT_SUCCESS;
}
Tidak ada komentar:
Posting Komentar