Program Menghitung Gaji

Hallo,
Pada kesempatan ini saya akan memposting program dengan bahasa pemrograman C yang digunakan untuk menghitung gaji.
Namun sebelum anda belajar bahasa pemrograman ini, anda harus menginstal aplikasi compiller seperti Dec-C++ atau CodeBlocks
·         Program Menghitung_Gaji
-          Sintaknya :
#include<stdio.h>
#include<conio.h>
#include<process.h>
main(){
                char lanjut='y';
                int posisi,masakerja;
                long gaji, tunjangan,total;
                do{
                                system("cls");
                                printf("                                                 PROGRAM MENGHITUNG GAJI KARYAWAN ");
                                printf("\n\n\n No.  Posisi    \n");
                                printf("\n 1.   Manager   \n");
                                printf("\n 2.   Karyawan  \n\n\n");
                                printf("\n\n pilih posisi (1/2)      : ");
                                scanf ("%d",&posisi);
                                printf("\n Masa Kerja anda (tahun) : ");
                                scanf("%d",&masakerja);
                                system("cls");
                                switch (posisi){
                                                case 1 : {
                                                                gaji=3000000;
                                                                if (masakerja<5){
                                                                                tunjangan=500000*masakerja;
                                                                                system("cls");
                                                                }
                                                               
                                                                else
                                                                if (masakerja>=5){
                                                                                  tunjangan=800000*masakerja;
                                                                }
                                                                total=gaji+tunjangan;

                            printf (" \n\nGaji anda sebagai Manajer adalah Rp. %ld + Rp. %ld = Rp. %ld\n\n",gaji,tunjangan,total);

                                                                break;
                                                }
                                                case 2 : {
                                                                gaji=2000000;
                                                                if (masakerja<5){
                                                                                tunjangan=300000*masakerja;
                                                                                system("cls");
                                                                }
                                                                else
                                                                if (masakerja>=5){
                                                                tunjangan=600000*masakerja;
                                                                }
                                                                total=gaji+tunjangan;

                            printf ("\n\n Gaji anda sebagai Karyawan adalah Rp. %ld + Rp. %ld = Rp. %ld\n\n",gaji,tunjangan,total);

                                                                break;
                                                }
                                                default :{
                                                                printf("\n\n Anda salah memasukan posisi atau masa kerja, mohon ulangi");
                                                                break;
                                                }
                                }             

                printf("\n\n_________________________________________________\n\n");      
                printf("\n\napakah anda ingin menghitung gaji lagi (y/t) ? : "); scanf("%s",&lanjut);
                }while(lanjut=='y');          system("cls");
                               
                printf(" \n\n\n Anda sudah keluar dari program ini\n\n");
                getch ();
                return 0;
}

               
Outputnya :



  Demikianlah Program menghitung gaji dengan menggunakan menu. Semoga bermanfaat.

Tidak ada komentar:

Posting Komentar