ar_one_to. Diberdayakan oleh Blogger.
RSS

program mencari kpk

KPK is a continuation of the Guild's Smallest Multiples.
The definition of multiples are multiples of a number.
Example: Multiples of the number 3 is 3, 6, 9, 12, 15, ... (etc. ..)
Another example: Multiples of the number 4 is 4, 8, 12, 16, 20, ... (etc. ..)
Examples go again: Multiples of the number 6 is 6, 12, 18, 24, 30 ... (and so on ..)
Here also made a program using the C language, this program can help to find a KPK. Consider the following source code:

#include
#include

using namespace std;

    class kpk {
  public:
     void input();
     void output();
     void proses();

  private:
        int a,b,c;
        int nilai;
   };

    void kpk::input(){
    cout<<"Masukkan Nilai Bil A : "; cin>>a;
    cout<<"Masukkan Nilai Bil B : "; cin>>b;
        }

void kpk::proses(){
    for(int x=1;x<=b;x++)
    nilai=nilai+a;
    if(nilai % b==0);
}

void kpk::output()
{

proses();
cout<< " KPK Antara " << a << " dan " << b << " Adalah " << nilai << endl;
}

int main(){

kpk bilangan;
bilangan.input();
bilangan.output();
system("PAUSE");
return EXIT_SUCCESS;
}

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

program koversi angka k'huruf

I am here as a junior programmer to give an example of a simple program using C language, which can help proram by lecturers or teachers to provide the converted value of a digit into the letter obtained by the students. Soure Consider the following code:


#pragma argsused
#include
class MAHASISWA {
int NIM;
char Name[25];
int Nilai;
char grade;
public:
void SetMahasiswa(){
cout<<"masukkan NIM          :";
cin>>NIM;
cout<<"masukkan Name         :";
cin>>Name;
cout<<"masukkan Nilai Akhir  :";
cin>>Nilai;
cout<<"\n";
}    
void InfoMahasiswa(){
cout<<"NIM          :"<<
cout<<"Name         :"<<
cout<<"Nilai Akhir  :"<<
if (Nilai > 90 && Nilai < 100)
{
grade = 'A';
}
else if (Nilai > 80 && Nilai < 90)
{
grade = 'B';
}
else if (Nilai > 70 && Nilai < 80)
{
grade = 'C';
}
else if (Nilai > 60 && Nilai < 70)
{
grade = 'D';
}
else
{
grade = 'E';
}
cout<<"Hi got grade :"<<
cout<<"\n";
}
};
int main(){
int x;
MAHASISWA M;
M.InfoMahasiswa();
M.SetMahasiswa();
cin>>x;
return 0;
}

Observe and understand source code above, hopefully this program can help semwa among those who need them ... .. may be useful ...

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS