TUGAS PRAKTIKUM

PEMROGRAMAN 2
MENGGUNAKAN BAHASA C

Modul 2: Input dan Output

NAMA
NPM
PRODI

: OKTAVA SUGANDA
: 09.0504.0019
: TEKNIK INFORMATIKA S1

FAKULTAS TEKNIK
UNIVERSITAS MUHAMMADIYAH MAGELANG
2009 / 2010

#include "stdio.h"
#include "conio.h"
void main()
{
char kode[20];
char nama[20];
float harga, jumlah, jml_hrg;
clrscr();
printf("***************************************
printf("***************************************\n");
printf("** PROGRAM MENGHITUNG JUMLAH HARGA **\n");
**
printf("*****************************
printf("***************************************\n");
printf("** NAMA = OKTAVA SUGANDA
**\n");
**
printf("** NPM = 09.0504.0019
**\n");
**
printf("***************************************
printf("***************************************\n\n");
printf("=======================================
printf("=======================================\n");
printf("\n
n Kode Barang : ");
"
scanf("%s",&kode);
printf("\n
n Nama Barang : ");
scanf("%s",&nama);
n Harga
: Rp ");
printf("\n
scanf("%f",&harga);
printf("\n
n Jumlah
: ");
scanf("%f",&jumlah);
jml_hrg=harga*jumlah;
printf("=======================================
printf("=======================================\n");
printf(" Kode Barang = %s\n",kode);
%s
printf(" Nama Barang = %s\n",nama);
%s
printf(" Harga
= Rp %.2f\n",harga);
%.2f
printf(" Jumlah
= %.0f\n",jumlah);
%.0f
printf(" Jumlah harga= Rp %.2f\n",jml_hrg);
%.2f
printf("=======================================
printf("=======================================\n");
getch();
}

#include "stdio.h"
#include "conio.h"
void main()
{
char kode[20];
char nama[20];
float harga, jumlah, jml_hrg, diskon, harga_diskon;
clrscr();
printf("***************************************
printf("***************************************\n");
printf("** PROGRAM MENGHITUNG JUMLAH HARGA **\n");
printf("***************************************
printf("***************************************\n");
printf("** NAMA = OKTAVA SUGANDA
**\n");
**
printf("** NPM = 09.0504.0019
**\n");
**
printf("***************************************
printf("***************************************\n\n");
printf("=========================
printf("=======================================\n");
printf("\n
n Kode Barang : ");
scanf("%s",&kode);
printf("\n
n Nama Barang : ");
scanf("%s",&nama);
n Harga
: Rp ");
printf("\n
scanf("%f",&harga);
printf("\n
n Jumlah
: ");
scanf("%f",&jumlah);
diskon=0.2*harga;
harga_diskon=harga-diskon;
iskon;
jml_hrg=harga_diskon*jumlah;
printf("=======================================
printf("=======================================\n");
printf(" Kode Barang = %s\n",kode);
%s
printf(" Nama Barang = %s\n",nama);
%s
printf(" Harga
= Rp %.2f\n",harga);
%.2f
printf(" Diskon
= 20\%\n");
20
printf(" Jumlah
= %.0f\n",jumlah);
printf(" Jumlah harga= Rp %.2f\n",jml_hrg);
%.2f
printf("=======================================
printf("=======================================\n");
getch();
}

Sign up to vote on this title
UsefulNot useful