Algorithm program to print a number that is divisible by 3 and 5 between 1 to 100
1. program will display the statement "a simple program displays a number between 1-100 is divisible by 3 and 5" to the user.
2. after the program returns to call the function process.
3. function check process will be repeated from 100-100 numbers are depleted in the 3 and 5. If the 1-100 number is divisible by 3 and 5 the remainder is o, then the program will display the number and save it as a number. If not the program will ignore these numbers. Repeated until the number 100 in checks. And reverse the total value to the main function as the number of numbers which can be divided into 3 and 5.
4. function reverses the process of value to the function main.
5. program displays the output to the user.
PROGRAM NYA:
#include
#include
class bil{
public:
int proses();
private:
int total;
};
int bil::proses()
{
total=0;
for(int i=1;i<100;i++){
if(i%3==0 && i%5==0)
{
cout<
Algorithm program to print a number that is divisible by 3 and 5 between 1 to 100
simulation program to purchase fuel
simulation program to purchase fuel
task group:
1. Ibnu Abdullah A (10018079)
2. Andri Kurniawan (10018054)
3. Bambang Priyanto (10018039)
4. Beti Wahyu Putro (10018064)
simulation buy fuel with specifications:
Input form:
money / how many liters that will be purchased
Type of fuel to be purchased
Indicators will continue (increasing 0.1liter) for the total price / number of liters of fuel purchased not exceed demand
Output states:
The number of liters purchased (if the input in the form of money)
Total money to be paid (if the input in the form liter)
#include
#include
using namespace std;
int main(int argc, char *argv[])
{
class spbu (){
friend ostream& opreator<<(ostream&,spbu&); friend istream& operator>>(istream&,spbu&);
public :
void banyak();
void pilihan();
void hitung_liter();
void hitung_harga();
private :
int harga;
int Biaya;
int a,b ;
float hasil ;
float premium ;
float solar ;
float pertamax ;
};
void banyak::liter(){
cout<<"Masukkan berapa liter yang dibutuhkan : "; cin>>x;
}
void banyak::pilihan(){
cout<<"pilih 1 untuk premium\n"<<<"pilih 2 untuk solar\n"<<<"pilih 3 untuk pertamax\n"<<<"Masukkan pilihan : "; cin>>y;
}
void banyak::hitung_liter(){
float i = 0.0;
while(i <= x){
i = i + 0.1;
cout<<
}
}
void banyak::hitung_harga(){
float hasil = 0.0;
float premium = 4500;
float solar = 6000;
float pertamax = 8000;
if(y == 1)
hasil = x * premium;
else if(y == 2)
hasil = x * solar;
else if(y == 3)
hasil = x * pertamax;
cout<<"harga : "<<
}
void main(){
spbu :
banyak.banyak();
banyak.harga();
banyak.hitung_liter();
banyak.hitung_harga();
system("PAUSE");
return EXIT_SUCCESS;
}
java program to calculate the factorial
Award as the value of factorial is the result of the multiplication of positive integers less than or equal to the value N. Writing is usually a factorial: n!
berikut programnya :
import jeliot.io.*;
public class faktorial
{
public static void main (String[ ] args)
{
long limit = 20; // menghitung faktorial integer daeri 1 – 20
long faktorial = 1; // pendefinisian variabel faktorial
for (int i = 0; i <= limit; i++)
{
faktorial = 1;
for (int faktor = 2; faktor <= i; faktor ++)
faktorial *= faktor;
System.out.println (i + "!" + " adalah " + faktorial);
}
}
}