C++ Fungsi Cek Status Angka

#include<iostream>
#include<conio.h>
int bil,n;
void abs(int i){
if(i<0){
    cout<<i*(-1)<<endl;
   }else{
    cout<<i<<endl;
   }
}

void doubel(int j){
n=j*2;
cout<<n<<endl;
}

void ood(int k){
if(k%2==0){
    cout<<" Bukan bilngan ganjil"<<endl;
   }else{
    cout<<" Bilangan ganjil"<<endl;
   }
}

main(){
cout<<" Masukan angka : ";
cin>>bil;
cout<<endl;
cout<<" Nilai mutlak dari "<<bil<<" = ";
abs(bil);
cout<<"\n Nilai 2 kali lipat = ";
doubel(bil);
cout<<"\n Nilai tersebut : ";
ood(bil);
getch();
}

0 Response to "C++ Fungsi Cek Status Angka"

Posting Komentar