#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
// 1 radian = 57.3 derajat
float derajat;
puts ("===========================");
puts (" Konversi derajat ke radian");
puts ("===========================");
printf ("Masukkan derajat : ");
scanf ("%f", &derajat);
float radian = derajat/57.3;
printf ("Nilai derajat : %2.2f radian", radian);
return 0;
}
Jumat, 28 Februari 2014
Kamis, 27 Februari 2014
Pemrograman C Konversi Menit Ke Derajat.
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
// 1 derajat = 60 menit
float menit;
puts ("==========================");
puts (" Konversi menit ke derajat");
puts ("==========================");
printf ("Masukkan menit : ");
scanf ("%f", &menit);
// Perhitungan
float derajat = menit/60;
// Tampilan
if (menit!=0&&menit!=60){
printf ("Nilai derajat : %2.2f derajat", derajat);
}
else
printf ("Nilai derajat : %.f derajat", derajat);
return 0;
}
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
// 1 derajat = 60 menit
float menit;
puts ("==========================");
puts (" Konversi menit ke derajat");
puts ("==========================");
printf ("Masukkan menit : ");
scanf ("%f", &menit);
// Perhitungan
float derajat = menit/60;
// Tampilan
if (menit!=0&&menit!=60){
printf ("Nilai derajat : %2.2f derajat", derajat);
}
else
printf ("Nilai derajat : %.f derajat", derajat);
return 0;
}
Senin, 24 Februari 2014
Pemrograman C, Bentuk Baku a * 10^n
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
float a , n ;
float a1, n1 ;
puts ("-------------------------------------");
puts ("|kecepatan (Bentuk baku : a * 10^n) |");
puts ("-------------------------------------");
printf ("Masukan nilai a : ");
scanf ("%f", &a);
printf ("Masukan nilai n : ");
scanf ("%f", &n);
puts ("---------------------------------");
puts ("|jarak (Bentuk baku : a * 10^n) |");
puts ("---------------------------------");
printf ("Masukan nilai a : ");
scanf ("%f", &a1);
printf ("Masukan nilai n (10^n) : ");
scanf ("%f", &n1);
// perhitungan
// s = vt ===> t = s/v
float t = a1/a;
float t1 = n1-n;
printf ("\nWaktu tempuh adalah : %2.2f * 10^%.f", t,t1);
return 0;
}
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
float a , n ;
float a1, n1 ;
puts ("-------------------------------------");
puts ("|kecepatan (Bentuk baku : a * 10^n) |");
puts ("-------------------------------------");
printf ("Masukan nilai a : ");
scanf ("%f", &a);
printf ("Masukan nilai n : ");
scanf ("%f", &n);
puts ("---------------------------------");
puts ("|jarak (Bentuk baku : a * 10^n) |");
puts ("---------------------------------");
printf ("Masukan nilai a : ");
scanf ("%f", &a1);
printf ("Masukan nilai n (10^n) : ");
scanf ("%f", &n1);
// perhitungan
// s = vt ===> t = s/v
float t = a1/a;
float t1 = n1-n;
printf ("\nWaktu tempuh adalah : %2.2f * 10^%.f", t,t1);
return 0;
}
Senin, 17 Februari 2014
Pemrograman C Menggunakan While, Perkalian 1 - 10
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int j=1, k;
printf ("==================================================\n");
while (j<=10){
k=1;
while (k<=10){
printf ("%4d|", j*k);
k++;
}
printf ("\n");
printf ("==================================================\n");
j++;
}
return 0;
}
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int j=1, k;
printf ("==================================================\n");
while (j<=10){
k=1;
while (k<=10){
printf ("%4d|", j*k);
k++;
}
printf ("\n");
printf ("==================================================\n");
j++;
}
return 0;
}
Jumat, 14 Februari 2014
Pemrograman C Menggunakan For, Perkalian 1 - 10
#include <stdio.h>
#include <stdlib.h>
#define maks 11
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int baris, kolom, hasil_kali;
printf ("==================================================\n");
for (baris=1;baris<maks;baris++){
for (kolom=1;kolom<maks;kolom++){
hasil_kali = baris*kolom;
printf ("%4d|", hasil_kali);
}
printf ("\n");
printf ("==================================================\n");
}
return 0;
}
#include <stdlib.h>
#define maks 11
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int baris, kolom, hasil_kali;
printf ("==================================================\n");
for (baris=1;baris<maks;baris++){
for (kolom=1;kolom<maks;kolom++){
hasil_kali = baris*kolom;
printf ("%4d|", hasil_kali);
}
printf ("\n");
printf ("==================================================\n");
}
return 0;
}
Pemrograman C Menghitung Bunga Deposito
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int jangkawaktu;
float deposito, bunga;
do {
printf ("Jumlah Deposito : Rp. ");
scanf ("%f", &deposito);
if (deposito<10000000){
printf ("============================\n");
printf ("Deposito minimal Rp. 10 Juta\n");
printf ("============================\n");
}
} while (deposito<10000000);
do {
printf ("Jangka waktu : ");
scanf ("%d", &jangkawaktu);
if (jangkawaktu>24){
printf ("==============================\n");
printf ("Jangka waktu maksimal 24 bulan\n");
printf ("==============================\n");
}
} while (jangkawaktu>24);
switch (jangkawaktu){
case 1: {
bunga=0.0425*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("\n=============================================\n");
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
case 2: {
printf ("\n=============================================\n");
bunga=0.0450*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
case 3: {
printf ("\n=============================================\n");
bunga=0.0475*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
case 6: {
printf ("\n=============================================\n");
bunga=0.0550*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
case 12: {
printf ("\n=============================================\n");
bunga=0.0600*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
case 18: {
printf ("\n=============================================\n");
bunga=0.0625*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
case 24: {
printf ("\n=============================================\n");
bunga=0.0650*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
default:
printf ("\nJangka waktu 1,2,3,6,12,18 atau 24 bulan.\n");
}
return 0;
}
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int jangkawaktu;
float deposito, bunga;
do {
printf ("Jumlah Deposito : Rp. ");
scanf ("%f", &deposito);
if (deposito<10000000){
printf ("============================\n");
printf ("Deposito minimal Rp. 10 Juta\n");
printf ("============================\n");
}
} while (deposito<10000000);
do {
printf ("Jangka waktu : ");
scanf ("%d", &jangkawaktu);
if (jangkawaktu>24){
printf ("==============================\n");
printf ("Jangka waktu maksimal 24 bulan\n");
printf ("==============================\n");
}
} while (jangkawaktu>24);
switch (jangkawaktu){
case 1: {
bunga=0.0425*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("\n=============================================\n");
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
case 2: {
printf ("\n=============================================\n");
bunga=0.0450*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
case 3: {
printf ("\n=============================================\n");
bunga=0.0475*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
case 6: {
printf ("\n=============================================\n");
bunga=0.0550*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
case 12: {
printf ("\n=============================================\n");
bunga=0.0600*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
case 18: {
printf ("\n=============================================\n");
bunga=0.0625*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
case 24: {
printf ("\n=============================================\n");
bunga=0.0650*jangkawaktu/12*deposito;
float modalditerima=bunga+deposito;
printf ("Modal Deposito : Rp. %.f\n", deposito);
printf ("Bunga diterima dalam %d bulan : Rp. %.f\n", jangkawaktu, bunga);
printf ("Total uang yang akan diterima : Rp. %.f\n", modalditerima);
printf ("=============================================");
break;
}
default:
printf ("\nJangka waktu 1,2,3,6,12,18 atau 24 bulan.\n");
}
return 0;
}
Langganan:
Postingan (Atom)