Uts.docx

  • Uploaded by: Johanes Kevins
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Uts.docx as PDF for free.

More details

  • Words: 371
  • Pages: 8
#include<stdio.h> int main()

{ int a,b,e,total=0; char c; do { printf("\t\tSelamat Datang di Counter TATA PONSEL\n\n"); printf("\n1. Oppo"); printf("\n2. Iphone"); printf("\n3. Samsung"); printf("\nMasukkan Pilihan Anda :"); scanf("%d", &a); switch (a) { case 1: printf("\n1. Oppo A37 = Rp. 3.100.000,00"); printf("\n2. Oppo F7 =Rp. 4.000.000,00 "); printf("\n3. Oppo F9 = Rp. 5.000.000,00"); printf("\nMasukkan Pilihan Anda :"); scanf("%d",&b); switch (b) { case 1: total=total+3100000;

break; case 2: total=total+4000000; break; case 3: total=total+5000000; break; default : printf("\n\tPilihan anda tidak tersedia"); } break;

case 2: printf("\n1. Iphone 4 = Rp. 3.000.000,00"); printf("\n2. Iphone 5 = Rp. 4.000.000,00"); printf("\n3. Iphone 6s = Rp. 5.000.000,00"); printf("\nMasukkan Pilihan Anda :"); scanf("%d", &b); switch (b) { case 1: total=total+3000000; break; case 2: total=total+4000000; break;

case 3: total=total+5000000; break; default : printf("\n\tPilihan anda tidak tersedia"); } break;

case 3: printf("\n1. Samsung Galaxy J2 = Rp. 1.500.000"); printf("\n2. Samsung Galaxy A6 = Rp. 2.600.000"); printf("\n3. Samsung Galaxy J7 = Rp. 6.000.000"); printf("\nMasukkan Pilihan Anda :"); scanf("%d", &b); switch (b) { case 1: total=total+1500000; break; case 2: total=total+2600000; break; case 3: total=total+6000000; break; default :

printf("Pilihan anda tidak tersedia"); } break; } e: printf("Masih adakah yang ingin anda beli?\nInput :"); scanf(" %s",&c); if(c!='y'&&c!='Y'&&c!='t'&&c!='T') goto e; }while(c=='y'||c=='Y'); printf("Total belanja yang harus dibayar %d", total); if(total>=8000000) { printf("\nSelamat Anda mendapat Bonus Power Bank"); } return 0; }

2.

#include<stdio.h> int main() { int a,b,e,total=0; char c;

do { printf("\t\tSelamat Datang di Counter TATA PONSEL\n\n"); printf("\n1.Oppo"); printf("\n2.Iphone"); printf("\n3.Vivo"); printf("\nMasukkan Pilihan Anda:"); scanf("%d",&a); switch(a) { case 1: printf("\n1.Oppo A37=Rp.3.000.000,00"); printf("\n2.Oppo F7=Rp.4.000.000,00"); printf("\n3.Oppo F9=Rp.5.000.000,00"); printf("\nMasukkan Pilihan Anda:"); scanf("%d",&b); switch(b) { case 1: total=total+3000000; break; case 2: total=total+4000000; break; case 3: total=total+5000000;

break; default: printf("\n\tPilihan Anda Tidak Tersedia"); } break;

case 2: printf("\n1.Iphone 4=Rp.4.000.000,00"); printf("\n2.Iphone 5=Rp.5.500.000,00"); printf("\n3.Iphone X=Rp.12.000.000,00"); printf("\nMasukkan Pilihan Anda:"); scanf("%d",&b); switch(b) { case 1: total=total+4000000; break; case 2: total=total+5500000; break; case 3: total=total+12000000; break; default: printf("\n\tPilihan Anda Tidak Tersedia"); }

break;

case 3: printf("\n1.Vivo A3=Rp.3.600.000,00"); printf("\n2.Vivo A5=Rp.4.100.000,00"); printf("\n3.Vivo A9=Rp.5.400.000,00"); printf("\nMasukkan Pilihan Anda:"); scanf("%d",&b); switch(b) { case 1: total=total+3600000; break; case 2: total=total+4100000; break; case 3: total=total+5400000; break; default: printf("\n\tPilihan Anda Tidak Tersedia"); } break; }

e:

printf("Masih Adakah Yang Ingin Anda Beli?\nInput:"); scanf("%s",&c); if(c!='y'&&c!='Y'&&c!='t'&&c!='T') goto e; } while(c=='y'||c=='Y'); printf("Total Belanja Yang Harus Anda Bayar%d",total); if(total>=6000000) { printf("\nSelamat Anda Mendapatkan Bonus POWER BANK"); } return 0; }

More Documents from "Johanes Kevins"