#include <iostream.h>
int tambah (int a, int b)
{
int r;
r = a+b;
return r;
}
int main()
{
int z;
z=tambah(5,3);
cout<<"Hasilnya="<<z;
return 0;
}
----------------------------------------------------------------
#include <iostream.h>
int tambah(int a, int b =2 );
int main()
{
int z;
z=tambah(5,3);
cout<<"Hasilnya="<<z;
return 0;
}
int tambah (int a, int b)
{
int r;
r = a+b;
return r;
}
----------------------------------------------------------------
#include <iostream.h>
int pembagian (int a, int b=2)
{
int r;
r = a/b;
return (r);
}
int main()
{
cout<<pembagian(12);
cout<<endl;
cout<<pembagian(20,4);
return 0;
}
No comments:
Post a Comment