Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  Tugas2
Language: C/C++
Code:
/*potongan harga untuk 3 kaleng*/

#include <stdio.h>
#include <iostream.h>
#include <conio.h>
int main()
{
    float j_unit, harga, nilai;
    int i;
    
    printf("POTONGAN HARGA SUSU\n");
    for (i=0; i<19; i++) printf("="); printf("\n");
    
    printf("Jumlah unit?");
    scanf("%f", &j_unit);
    
    printf("Harga unit ?");
    scanf("%f",&harga);
    
    if(j_unit <=3)
        nilai = j_unit * harga * 0.8;
    else
        nilai = (3 * harga * 0.8) + (j_unit - 3) * harga;
        
    printf("Total harga = %.0fn",nilai);
    printf("NIM 21814129147");
    getch();


          
          
Comments: