Monday, March 11, 2013



BAHASA C  di  KEYBOARD

Ø Untuk menampilkan sebuah File  ( di keyboard ) Tekan Alt dan  F
Ø Untuk Run Tekan Ctrl dan F9
Ø Untuk membuat  program Bahasa C Minimize  , Tekan Alt dan Sepasi
Ø Untuk membuat program Bahasa C jadi kecil , Tekan Alt dan Enter

                                Sistem Kerja Bahasa C
Keterangan :
Perogram di atas ini harus Tepat dan Ada  jika anda ingin melakukan program Bahasa C supaya Run bisa jalan.
Mengubah Warna Hasil Run di Bahasa C  :




Rounded Rectangular Callout:  Kelik kanan pakai Mause



















Rectangular Callout: Dan atur warna
Yang anda mau


Oval Callout: Keyboard

Tekan  Shift  dan  picik tanda ini :





#include<stdio.h>
main()
{
     int jum,i;
     jum=0;
     i=6;
     while(i<=10) || (1>=i)
     {
      jum=jum+i;
      printf("FMIPA UNMUL \n");  
      i=i+2;
     }
      printf("nilai jum dan i = %d dan %d\n",jum,i);
getch();
}










               


BAHASA C


/* program bilangan terbesar & terkecil */

# include <stdio.h>

main()
{
 int a, b, c, max, min ;

 clrscr();
 printf("Masukan bil 1 : ");scanf("%d",&a);
 printf("Masukan bil 2 : ");scanf("%d",&b);
 printf("Masukan bil 3 : ");scanf("%d",&c);

 if (a>b) { max=a; min=b;}
 else
  {max=b; min=a;}
 if (c>max) max=c;
 if (c<min) min=c;
 printf("Maka bilangan terbesar adalah %d\n",max);
 printf("Maka bilangan terkecil   adalah %d",min);
 getch();
}



Description: bH
Bahasa C

# include <stdio.h>

main()
{
 int pil;
 clrscr();
 printf("--------Menu Makanan Semua Suka---------\n");
 printf("        1. Martabak Telor                                \n");
 printf("        2. Fu Yung Hai                                    \n");
 printf("        3. Nasi Goreng Gosong                      \n");
 printf("        4. Soto Banjar Kelua                           \n");
 printf("        5. Keluar                                              \n");
 printf("------------------------------------------------------ \n");

 printf("Apa pilihan Saudara [ 1 - 5 ] ? ");
 scanf("%d",&pil);
 printf("\n");

 switch(pil) {
 case 1:
              printf("Anda Memilih Martabak Telor, Tarif Rp. 5000");
              break;
 case 2:
             printf("Anda Memilih Fu Yung Hai , Tarif Rp. 10000");
             break;
 case 3:
             printf("Anda Memilih Nasi Goreng Gosong , Tarif Rp. 15000");
             break;
 case 4:
             printf("Anda Memilih Soto Banjar Kelua , Tarif Rp. 12000");
             break;
 case 5:
             printf("Terima Kasih");
             break;
 }
 getch();
}

Description: b

BAHASA C


#include<stdio.h>
#define max 40

struct TMHS
 {char nama[30];int nil1,tgs,uas;float NA;char NH;}Mhs[max];
int i,n;
main()
{
 clrscr();
 printf("Jumlah mahasiswa = ");scanf("%d",&n);
 for(i=1;i<=n;i++)
 { printf("Data mahasiswa ke-%d \n",i);
   printf("Nama : ");  scanf("%s",&Mhs[i].nama);
   printf("Nilai 1: ");scanf("%d",&Mhs[i].nil1);
   printf("Tugas : "); scanf("%d",&Mhs[i].tgs);
   printf("Ujian akhir semester= ");scanf("%d",&Mhs[i].uas);

 Mhs[i].NA=0.25*Mhs[i].nil1 + 0.25*Mhs[i].tgs + 0.5*Mhs[i].uas;
 if(Mhs[i].NA<40) Mhs[i].NH='E';
 else if(Mhs[i].NA<60) Mhs[i].NH='D';
 else if(Mhs[i].NA<70) Mhs[i].NH='C';
 else if(Mhs[i].NA<80) Mhs[i].NH='B';
 else Mhs[i].NH='A'; }

 printf("---------------------------------------------------------------\n");
 printf("        Nama       Nilai1      Tugas      Uas       NA      NH \n");
 printf("---------------------------------------------------------------\n");
 for(i=1;i<=n;i++)
 { printf("%12s %10d %10d %10d %10.2f %5c \n",Mhs[i].nama,Mhs[i].nil1,
   Mhs[i].tgs,Mhs[i].uas,Mhs[i].NA,Mhs[i].NH); }
 printf("---------------------------------------------------------------\n");
getch();
}


Description: b
BAHASA C



#include <stdio.h>
main()
{
 float np;
 float abonemen, bypky, bp, iursmph;
 float tghn;

 clrscr();
 printf("Masukan Nomor Pelanggan Anda : ");scanf("%f",&np);
 printf("Masukan Besar Pemakaian Listrik Anda : ");scanf("%f",&bp);


 abonemen=5000; iursmph=1000;
 bypky=bp*375;
 tghn=abonemen+bypky+iursmph;


 printf("Tagihan Listrik Anda bulan ini adalah sebesar Rp %10.2f",tghn);
 getch();
}


Description: b




BAHASA C

#include<stdio.h>
main ()
{
  int a1,b1,a,b,r,fpb,kpk;
  clrscr();
  printf("Masukkan bilangan pertama :");scanf("%d",&a);
  printf("Masukkan bilangan kedua   :");scanf("%d",&b);

  a1=a;
  b1=b;
  r=a%b;
  if(r==0){
  fpb=b;
  }
  else
  while(r!=0){
  a=b;
  b=r;
  r=a%b;
  }
  fpb=b;
  kpk=(a1*a1)/fpb;
  printf("\n");
  printf("FPB dari %d dan %d adalah = %d\n",a1,b1,fpb);
  printf("KPK dari %d dan %d adalah = %d\n",a1,b1,kpk);
  getch();
}

Description: b
BAHASA C




#include <stdio.h>

main()
{
 int jum,i;
 jum=0;
 i=6;

  do
  {
   jum = jum +i;
   printf ("  fmipa unmul \n");
   i = i+2;
  }
   while (i<= 10);
   printf ("  nilai jum dan i = % d dan %d\n", jum, i);
   getch();
 }



Description: b




/*program rata_rata*/

# include<stdio.h>
# include<math.h>
main()
{
typedef int xx [51];
 xx x;
 float j,r,t,sd;
 int n,i ;
 clrscr();

 printf("masukkan banyaknya data: ");scanf("%d",&n);
 t=0;
 i=1;
 while(i<= n)
 {
  printf(" Data ke %d : ",i);scanf("%d",&x[i]);
  t=t+x[i];i++;
 }
 r= t/n; j=0;
 for(i=1;i<=n;i++)
 {j=j+((x[i]-r)*(x[i]-r));
  sd=sqrt(j/n);}
 printf("\n Nilai Rata-Rata  : %3.2f ",r);
 printf("\n Standard deviasi : %3.2f ",sd);
 getch();
}


Description: b
BAHASA C


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

main()
{
 int X;
 float Celcius, Fahrenheit;

 clrscr();
 printf("%5s%12s%12s\n","-----","----------","-----------");
 printf("%5s%12s%12s\n","    X","   Celcius"," Fahrenheit");
 printf("%5s%12s%12s\n","-----","----------","-----------");

 Celcius = 0;
 for(X=1;X<=10;X++)
 {
 Fahrenheit = 1.8*Celcius + 32;
 printf("%5d%10.2f%10.2f\n",X,Celcius,Fahrenheit);
 Celcius=Celcius + 10;
  }
  printf("%5s%12s%12s\n","-----","----------","-----------");
  getch();
 }



Description: b

BAHASA C


#include<stdio.h>
#include<string.h>
main()
{
 float nilai;
 char keterangan1[15]="lulus";
 char komentar1[80]="selamat saudara lulus";
 char keterangan2[15]="tidak lulus";
 char komentar2[80]="sorry,saudara perlu belajar lebih keras";
 clrscr();
 printf("masukan nilai ujian saudara yang anda dapat:");scanf("%f",&nilai);

 if(nilai>60){
  printf("%s\n",keterangan1);
  printf("%s\n",komentar1);
  }
 else{
  printf("%\n",keterangan2);
  printf("%\n",komentar2);
  }
getch();
}




Description: b

BAHASA C


/*-------------------------------------------*/
/*               PROBLEM 1                   */
/*NAMA:JONATHAN                              */
/*NIM:04.44987.01416.08                      */
/*TANGGAL:15 MARET 2005                      */
/*-------------------------------------------*/


#include<stdio.h>
main()
{
 int bil1,bil2,max,min;
 clrscr();
 printf("masukan bil1: ");scanf("%d",&bil1);
 printf("masukan bil2; ");scanf("%d",&bil2);
 if(bil1>bil2)max=bil1;
  else
   max=bil2;
  printf("bilangan terbesar adalah %d\n",max);
  getch();
}




Description: b


Soal :
           
Buat suatu program untuk menghitung  1 + 2 + 3 + . . . + n  =  ?  dan nilai rata-rata



BAHASA C




#include<stdio.h>
main()
{
 int n,nr2,i,jum;
 clrscr();
 printf("Masukan banyak data yang ingin dijumlahkan : ");scanf("%d",&n);
 jum=0;
 for (i=1;i<=n;i++)
  jum=jum+i;
 nr2=jum/n;printf("\n");printf("\n");
 printf("Jumlah semua data adalah %d\n",jum);printf("\n");
 printf("nilai rata-rata semua data adalah %d\n",nr2);printf("\n");printf("\n");

 getch();
}



Description: b

BAHASA C



#include<stdio.h>
typedef int matriks[10][50];
main()
{
 matriks m1,m2,hk;
 int i,j,k,n,m,p;
 clrscr();
 printf("jumlah baris m1:");scanf("%d",&m);
 printf("jumlah kolom m1:");scanf("%d",&n);
 printf("jumlah kolom m2:");scanf("%d",&p);
 printf("matriks pertama (m1) \n");
 for(i=1;i<=n;i++)
 for(j=1;j<=m;j++)
 {printf("elemen baris ke-%d kolom ke-%d:",i,j);scanf("%d",&m1[i][j]);}
 printf("matriks kedua (m2) \n");
 for(i=1;i<=n;i++)
 for(j=1;j<=p;j++)
 {printf("elemen baris ke-%d kolom ke-%d:",i,j);scanf("%d",&m2[i][j]);}
  for(i=1;i<=m;i++)
  for(j=1;j<=p;j++)
  {hk[i][j]=0;
  for(k=1;k<=n;k++)
  hk[i][j]+=m1[i][j]*m2[i][j];
  }
  printf("matriks m1 \n");
  for(i=1;i<=m;i++)
  {for(j=1;j<=n;j++)
  {printf("%d  ",m1[i][j]);}
  printf("\n");
  }
  printf("matriks m2 \n");
  for(i=1;i<=n;i++)
  {for(j=1;j<=p;j++)
  {printf("%d  ",m2[i][j]);}
  printf("\n");}
  printf("hasil perkalian matriks\n");
  for(i=1;i<=m;i++)
  {for(j=1;j<=p;j++)
  {printf("%d  ",hk[i][j]);}
  printf("\n");}
  getch();
  }

Description: b





























BAHASA C




#include <stdio.h>
main()
{
 int x, y;

 clrscr();
 printf("Masukan nilai x : ");scanf("%d",&x);


 y=3*(x*x*x*x)+8*(x*x*x)+13*(x*x)+9*x+17;


 printf("Nilai y adalah : %d\n",y);
getch();
}



Description: b







BAHASA C





/*Menggunakan Larik untuk menyimpan data*/
#include <stdio.h>
typedef char str [7];
main()
{
     str hari [7]=
             {"senin","selasa","rabu","kamis","jumat","sabtu","minggu"};
     int n;
     char lagi;

     lagi='y';
     while((lagi=='y')||(lagi=='y'))
     {
      printf("\nmasukan nomor hari = ");scanf("%d",&n);
      printf("maka hari ke- %d adalah %s\n",n,hari[n-1]);
      printf("mau coba lagi:y/t\n");lagi=getche();
     }
}



Description: b



Soal

Buatkan suatu program yang menerima data nama, alamat, dan nomor telepon ?



Bahasa C

#include <stdio.h>                                                           
 main()                                                                      
{ char nama[32], alamat[32], notp[32];                                       
 clrscr();                                                                    
                                                                             
 printf (" masukan nama anda      : "); scanf ("%s",&nama);                  
 printf (" masukan alamat anda    : "); scanf ("%s",&alamat);                
 printf (" masukan nomor telepon  : "); scanf ("%s",&notp);                  
                                                                                     
 printf ("\n nama anda adalah       : %s\n",nama);                            
 printf (" alamat anda adalah     : %s\n",alamat);                           
 printf (" nonor telepon anda     : %s\n",notp);                             
 getch();                                                                    
}                                                                            


Description: pnbp




Soal
Input     : nama, nim, jurusan, ip
Output  : menampilkan jumlah ip yang bisa di ambil
Proses   : ip > 3.00 jumlah ip yang bisa di ambil 24
               2.00 < ip < 3.00 jumlah ip yang bisa di ambil 20
               ip < 2.00 jumlah ip yang bisa di ambil 18

Bahasa C
#include <stdio.h>
main()
{
 char nama[32];
 char jurusan[32], nim[32];
 int sks_max;
 float ip;
 clrscr();
 printf(“masukan nama anda   : “);scanf(“%s”,&nama);
 printf(“masukan jurusan         : “);scanf(“%s”,&jurusan);
 printf(“masukan nim anda      : “);scanf(“%s”,&nim);
 printf(“masukan ip anda         : ”);scanf(“%f”,&ip);
 if (ip>=3.00)
 sks_max=24;
 if ((2.00<=ip)&&(ip<3.00))
 sks_max=20;
 if (ip<2.00)
 sks_max=18;
 printf(“\n nama     : %s\n”,nama);
 printf(“\n jurusan  : %s\n”,jurusan);
 printf(“\n nim        : %s\n”,nim);
 printf(“\n ip           : %5.2f\n”,ip);
 printf(“\n jumlah sks yang bisa anda ambil adalah : %i\n”,sks_max);
 getch();
 }


Description: pnbp


Bahasa C
                                                                             
#include<stdio.h>                                                            
typedef int matriks[50][50];                                                  
main()                                                                       
{ matriks A;                                                                 
  int r,t,l,m,pn,tn,x;                                                       
  int found;                                                                  
  clrscr();                                                                  
  printf("========MENCARI NILAI DALAM MATRIKS==========\n");                 
  printf("Masukkan jumlah Baris matriks yang anda mau : ");scanf("%d",&l);   
  printf("Masukkan jumlah Kolom matriks yang anda mau : ");scanf("%d",&m);   
  for(r=1;r<=l;r++)                                                          
  {                                                                           
     for(t=1;t<=m;t++)                                                       
      {                                                                      
        printf(" A[%d,%d] : ",r,t);scanf("%d",&A[r][t]);                     
      }                                                                      
  }                                                                          
  printf("\n Matriks A:\n");                                                  
  for(r=1;r<=l;r++)                                                          
  {                                                                          
     for(t=1;t<=m;t++)                                                        
      {                                                                      
        printf("%4d",A[r][t]);                                               
      }                                                                     
      printf("\n");                                                          
  }                                                                          
  printf(" masukkan nilai yang anda cari ? ");scanf("%d",&x);                
  pn=0;                                                                       
  tn=0;                                                                      
  r=1;                                                                       
  found=0;                                                                    
  while((r<=t)&&(found==0))                                                  
  {                                                                          
     t=1;                                                                     
     while((t<=m)&&(found==0))                                        
     { if (A[r][t]==x)                                                       
         found = 1;                                                          
       else                                                                  
          t=t+1;                                                             
     }                                                                       
     if(found==0)                                                             
          r=r+1;                                                             
     else                                                                    
       {  pn=r;                                                               
          tn=t;                                                              
        }                                                                    
   }                                                                          
  if(found==0)                                                               
      printf(" Tidak ketemu tidak ada dielemen matriks ??????",pn,tn);       
  else                                                                        
      printf(" Ketemu di matriks baris=%d dan kolom=%d !!!!!",pn,tn);        
      getch();                                                               
}                                                                            

Bahasa C


#include<stdio.h>                                                            
main()                                                                       
{                                                                            
 char pa[34],tp[43],isd[54];                                                 
 char bc[34],bi[43],kl[54];                                                  
 clrscr();                                                                   
                                                                              
 printf("          Semester 1               \n");                            
 printf("masukan nilai pendidikan agama  : ");scanf("%s",&pa);               
 printf("masukan nilai turbo pascal      : ");scanf("%s",&tp);               
 printf("masuakn niali ilmu sosial dasar : ");scanf("%s",&isd);              
                                                                             
 printf("          Semester 2      \n");                                      
 printf("masukan nilai bahasa C          : ");scanf("%s",&bc);               
 printf("masukan nilai bahasa inggris    : ");scanf("%s",&bi);               
 printf("masukan nilai kalkulus          : ");scanf("%s",&kl);               
                                                                              
 printf("\n");                                                               
  
 printf("=== MATA KULIAH SEMESTER 1 === \n");                                
 printf("  1. pendidikan agama      : %s\n",pa);                             
 printf("  2. turbo pascal          : %s\n",tp);                             
 printf("  3. ilmu sosial dasar     : %s\n",isd);                            
                                                                              
 printf("=== MATA KULIAH SEMESTER 2 === \n");                                
 printf("  1. bahasa c              : %s\n",bc);                             
 printf("  2. bahasa inggris        : %s\n",bi);                              
 printf("  3. kalkulus              : %s\n",kl);                             
                                                                             
getch();                                                                     
}                                                                             









0 comments:

Post a Comment

Newer Post Older Post Home

Nozh_Statistik

Selamat Datang, di Tunggu Ocehannya :) © copyright by Nozhbitha

Translate

Facebook Nozhbitha

Twitter-nozhbitha

Followers

copyright by Nozhbitha. Powered by Blogger.
 

Blog Archive