Mencari Nilai Minimum dari nilai kedua :
Input :
Output :
Input :
#include "iostream.h"
int minimum(int x,int y)
{
int min;
if (x<y)
min=x;
else
min=y;
return min;
}
int main()
{
int a,b,hasil;
cout<<"Masukkan A : ";
cin>>a;
cout<<"Masukkan B : ";
cin>>b;
hasil=minimum(a,b);
cout<<"Minimum dari nilai A & B : "<<hasil<<'\n';
}
int minimum(int x,int y)
{
int min;
if (x<y)
min=x;
else
min=y;
return min;
}
int main()
{
int a,b,hasil;
cout<<"Masukkan A : ";
cin>>a;
cout<<"Masukkan B : ";
cin>>b;
hasil=minimum(a,b);
cout<<"Minimum dari nilai A & B : "<<hasil<<'\n';
}
Output :
0 comments:
Post a Comment