PROGRAM MENENTUKAN NILAI GANJIL DAN GENAP
ALGORITMA
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int g;
cout<<"-----------------------------------"<<endl;
cout<<"Menentukan Nilai Ganjil dan Genap"<<endl;
cout<<"-----------------------------------"<<endl;
cout<<"Masukan nilai g : ";
cin>>g;
if (g % 2==0)
cout<<"Bilangan Genap"<<endl;
else
cout<<"Bilangan Ganjil"<<endl;
cout<<"------------------------------------"<<endl;
return 0;
}
RAPTOR :
Deskripsi :
N: integer } Pendeklarasian variabel yang akan digunakan
Algoritma :
Read (n) => untuk input
If (n mod 2 = 0) then
Write (“bilangan genap”)
Else
Write (“bilangan ganjil”)
End else
End if
Tampilkan output
DEV C++
#include <iostream>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int g;
cout<<"-----------------------------------"<<endl;
cout<<"Menentukan Nilai Ganjil dan Genap"<<endl;
cout<<"-----------------------------------"<<endl;
cout<<"Masukan nilai g : ";
cin>>g;
if (g % 2==0)
cout<<"Bilangan Genap"<<endl;
else
cout<<"Bilangan Ganjil"<<endl;
cout<<"------------------------------------"<<endl;
return 0;
}
RAPTOR :
0 komentar: