Kalkulator Sederhana


#include<stdio.h>
#include<conio.h>

void menu();
void jumlah();
void kurang();
void kali();
void bagi();

void main()
{
char chrPilihan;
do
{
menu();
fflush(stdin);
scanf(“%c”,chrPilihan);
if ((chrPilihan == ‘x’)||(chrPilihan == ‘x’))
{ printf(“Thanks for use this program… [email protected]”);
break;}
switch (chrPilihan)
{ case ‘1’:
jumlah();
break;
case ‘2’:
kurang();
break;
case ‘3’:
kali();
break;
case ‘4’:
bagi();
break;
default:
printf(“\nSorry bro.. Kode yang di imput salah…\n”);
}
}
while(chrPilihan != ‘x’);
}

void menu()
{
printf(” \n”);
printf(“Main Menu\n”);
printf(“==================\n”);
printf(“1. Operasi Penjumlahan\n”);
printf(“2. Operasi Pengurangan\n”);
printf(“3. Operasi Perkalian\n”);
printf(“4. Operasi Pembagian\n”);
printf(“x. Untuk Keluar\n”);
printf(” \n”);
printf(“Input kode masukkan,bro!!: “);
}

void jumlah()
{
int jumlah,bil1,bil2;
printf(“Bilangan 1 nya apa?? “);
scanf(“%d”,bil1);
printf(“Bilangan kedua?? “);
scanf(“%d”,bil2);
jumlah=bil1+bil2;
printf(“Hasilnya tambahannya %d\n”,jumlah);
printf(“\nPencet Enter buat lanjut..\n”);
getch();
}

void kurang()
{
int jumlah,bil1,bil2;
printf(“Bilangan 1 nya apa?? “);
scanf(“%d”,bil1);
printf(“Bilangan kedua?? “);
scanf(“%d”,bil2);
jumlah=bil1-bil2;
printf(“Hasilnya kurangannya %d\n”,jumlah);
printf(“\nPencet Enter buat lanjut..\n”);
getch();
}

void kali()
{
int jumlah,bil1,bil2;
printf(“Bilangan 1 nya apa?? “);
scanf(“%d”,bil1);
printf(“Bilangan kedua?? “);
scanf(“%d”,bil2);
jumlah=bil1*bil2;
printf(“Hasilnya kalinya %d\n”,jumlah);
printf(“\nPencet Enter buat lanjut..\n”);
getch();
}

void bagi()
{
int jumlah,bil1,bil2;
printf(“Bilangan 1 nya apa?? “);
scanf(“%d”,bil1);
printf(“Bilangan kedua?? “);
scanf(“%d”,bil2);
jumlah=bil1/bil2;
printf(“Hasilnya baginya %d\n”,jumlah);
printf(“\nPencet Enter buat lanjut..\n”);
getch();
}


21 responses to “Kalkulator Sederhana”

  1. wihihi.. ada info ne… ok bos hehe….
    ne aku cuma bisa program orang dodol aja
    //include file
    //int file n1,n2,h
    printf(“bil ke-1 : \n ” );
    scanf(” %d” , &n1);
    printf(“bil ke-2 : \n ” );
    scanf(” %d” , &n2);

    hasil= n1+n2
    printf(” hasil penjumlahan : %d “,&h);
    }

  2. keren bro,,, sangat membantu nih buat ngerjain tugas kuliah….!!!
    boleh aku posting d blog ku yah,,, aku sediakan link kesini pastinya,,,

  3. tolong kasih kode yang benar dong,,,,
    yang di atas udah aqu test tapi eror,,,,
    aqu ge da tugas ni,,,,,,,,
    butuh bangat,,,,,,
    bantu aqu ya,,,,,,,,

  4. #include
    #include
    #include
    float x1,x2;
    float persamaan(int a,int b,int c);

    void main()
    {
    clrscr();
    int a1=1,a2=2,a3=2,a4=5,a5=4,
    b1=3,b2=2,b3=5,b4=8,b5=4,
    c1=4,c2=3,c3=3,c4=3,c5=1;
    persamaan (a1,b1,c1);
    cout << endl;
    persamaan (a2,b2,c2);
    cout << endl;
    persamaan (a3,b3,c3);
    cout << endl;
    persamaan (a4,b4,c4);
    cout << endl;
    persamaan (a5,b5,c5);
    cout <0)
    {
    x1=b+sqrt(D)/(2.*a);
    x2=b-sqrt(D)/(2.*a);

    cout << "penyelesaian dari persamaan itu adalah " << x1 << " & " << x2 << endl;
    }

    else if(D==0)
    {
    x1=x2=-b/(2.*a);

    cout << "penyelesaian dari persamaan itu adalah " << x1 << endl;
    }

    else
    {
    cout << "persamaan itu tidak memiliki penylesaian" << endl;
    }

    return (x1,x2);
    }

  5. #include
    #include
    #include
    #include
    const int n = 6;

    void main ()
    {
    clrscr ();
    int ba[n] = {2332, 2313, 2313, 2131, 2311, 3421};
    int bb[n] = {1232, 1231, 1243, 1231, 1213, 1213};
    int D[n] = {-21, 23, 25, -21, 25, 21};
    int M[n] = {43, 43, 42, 43, 21, 42};
    double S[n] = {3.12, 34.21, 32.31, 43.23, 12.32, 32.21};
    double dd[n];
    double dd1[n];
    double d[n];
    double phi = atan(1) * 4.0;
    cout << setiosflags (ios::showpoint|ios::fixed);
    cout << setprecision (3);
    for(int i = 0; i <= 5; i++)
    {
    cout << "TGD [ "<< i << " ]";
    {
    if (D[i] < 0)
    D[i] = -1 * D[i];
    else
    D[i] = D[i] * 1;
    }
    dd[i] = D[i] + (M[i] / 60) + (S[i] / 3600);
    dd1[i] = dd[i] * (phi/180);
    d[i] = 10 * (ba[i] – bb[i]) * cos (dd1[i]) * cos (dd1[i]);
    cout << " jarak optis " << d << endl;
    }
    getch ();
    }

  6. #include
    #include
    #include
    #include
    const int n = 6;

    void main ()
    {
    clrscr ();
    int ba[n] = {2332, 2313, 2313, 2131, 2311, 3421};
    int bb[n] = {1232, 1231, 1243, 1231, 1213, 1213};
    int D[n] = {-21, 23, 25, -21, 25, 21};
    int M[n] = {43, 43, 42, 43, 21, 42};
    double S[n] = {3.12, 34.21, 32.31, 43.23, 12.32, 32.21};
    double dd[n];
    double dd1[n];
    double d[n];
    double phi = atan(1) * 4.0;
    cout << setiosflags (ios::showpoint|ios::fixed);
    cout << setprecision (3);
    for(int i = 0; i <= 5; i++)
    {
    cout << "TGD [ "<< i << " ]";
    {
    if (D[i] < 0)
    D[i] = -1 * D[i];
    else
    D[i] = D[i] * 1;
    }
    dd[i] = D[i] + (M[i] / 60) + (S[i] / 3600);
    dd1[i] = dd[i] * (phi/180);
    d[i] = 10 * (ba[i] – bb[i]) * cos (dd1[i]) * cos (dd1[i]);
    cout << " jarak optis " << d << endl;
    }
    getch ();
    }

  7. ferdi@:

    #include
    using namespace std;
    int main()
    {
    int a;
    cout<>a;
    cout<<endl;
    if (a % 2)
    cout<<"Angka ganjil";
    else
    cout<<"Angka genap";
    cout<<endl<<endl;

    system("pause");
    }

Leave a Reply