class Program
{
private static int Bayar()
{
int uang;
Console.Write("Banyak Uang = ");
uang=Convert.ToInt32(Console.ReadLine());
return uang;
}
private static int hargabarang()
{
int barang;
Console.Write("Harga barang = ");
barang= Convert.ToInt32(Console.ReadLine());
return barang;
}
private static void Kondisi(int a)
{
if (a<= 10000)
{
Console.WriteLine("Barang Murah");
}
else
{
Console.WriteLine("Barang Mahal");
}
}
public static void Main(string[] args)
{
int uang,barang,kembalian;
uang=Bayar();
barang=hargabarang();
kembalian=uang-barang;
Console.WriteLine("Kembalian = {0}",kembalian);
Kondisi(barang);
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);
}
}
#include#includeusing namespace std;int bayar(){int uang;cout << "Banyak Uang = ";cin >> uang;return uang;}int hargabarang(){int barang;cout<<"Harga Barang = ";cin>>barang;return barang;}void kondisi(int X){cout << X << endl;if (X<=10000){cout<<"Barang Murah";}else{cout<<"Barang Mahal";}}int main(int argc, char *argv[]){int uang,barang,kembalian;uang=bayar();cout< barang=hargabarang();cout< kembalian=uang-barang;cout <<"Kembalian = ";cout < cout< kondisi(barang);cout < system("PAUSE");return EXIT_SUCCESS;}
package javaapplication2;import com.sun.corba.se.spi.orbutil.fsm.Input;import java.util.Scanner;public class Main {static int Bayar(){Scanner bayar = new Scanner(System.in);int uang;System.out.print("Banywak Uang = ");uang=bayar.nextInt();return uang;}static int hargabarang(){Scanner barang = new Scanner(System.in);int uang;System.out.print("Harga Barang = ");uang=barang.nextInt();return uang;}static void kondisi(int x){if (x<=10000){System.out.print("Barang Murah");}else{System.out.print("Barang Mahal");}}public static void main(String[] args){int uang,barang,kembalian;uang=Bayar();barang=hargabarang();kembalian=uang-barang;System.out.print("Kembalian = ");System.out.println(kembalian);System.out.println();kondisi(barang);System.out.println();}}