Program 1:
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
int tambah(n1,n2)
{
return(n1+n2);
}
int kurang(n1,n2)
{
return(n1-n2);
}
int kali(n1,n2)
{
return(n1*n2);
}
int bagi(n1,n2)
{
return(n1/n2);
}
main()
{
int n1,n2,plus,minus,star,slash;
cout<<" Nilai 1 : ";cin>>n1;
cout<<" Nilai 2 : ";cin>>n2;
cout<<endl<<endl;
plus=tambah(n1,n2);
cout<<n1<<" + "<<n2<<" = "<<plus<<endl;
minus=kurang(n1,n2);
cout<<n1<<" - "<<n2<<" = "<<minus<<endl;
star=kali(n1,n2);
cout<<n1<<" x "<<n2<<" = "<<star<<endl;
slash=bagi(n1,n2);
cout<<n1<<" : "<<n2<<" = "<<slash<<endl;
getch();
}
Tampilan setelah di running :
Program 2 :
#include<stdio.h>
#include<iostream.h>
#include<conio.h>
garis()
{
printf("\n========================\n");
}
int luas(pjg,lbr)
{
return(pjg*lbr);
}
int kel(pjg,lbr)
{
return(2*(pjg+lbr));
}
main()
{
int luas_pp,kel_pp,pjg,lbr;
garis();
cout<<" LUAS DAN KELILING PERSEGI PANJANG "<<endl;
garis();
cout<<" Input Panjang :";cin>>pjg;
cout<<" Input Lebar :";cin>>lbr;
garis();
kel_pp=kel(pjg,lbr);
cout<<" Keliling :"<<kel_pp<<endl;
luas_pp=luas(pjg,lbr);
cout<<" Luas :"<<luas_pp<<endl;
garis();
getch();
}
Tampilan setelah di running :
SEMOGA BERMANFAAT,
ARIGATOU GOZAIMASU......HESO
0 comments:
:a: :b: :c: :d: :e: :f: :g:
:h: :i: :j: :k: :l: :m: :n:
Post a Comment