Tugas KP

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Tugas Praktikum Konsep Pemrograman

Nama : Kristianes

NRP : 115100056

#include <iostream.h>

#include <conio.h>

void main() {

int a=100, b=10,h;

float c=2, d,e,f,g;

clrscr();

cout<<"Program prog0303.c\n";

cout<<"Nilai awal\na=100\nb=10\nc=2\n";

cout<<"------------------------------------\n\n";

cout.precision(5);

d=a+c/(10+b);

e=(a+b)/2*b;

f=(e+d)/c;

g=(a+c)/(f+b);

h=b%a;

cout<<"d="<<a<<"+"<<c<<"/(10+"<<b<<") = "<<d<<"\n";

cout<<"e=("<<a<<"+"<<b<<")/2*"<<b<<" = "<<e<<"\n";

cout<<"f=("<<e<<"+"<<d<<")/"<<c<<" = "<<f<<"\n";

cout<<"g=("<<a<<"+"<<c<<")/("<<f<<"+"<<b<<") = "<<g<<"\n";

cout<<"h="<<b<<" mod "<<a<<" = "<<h;

getch();

Institut Teknologi Indonesia 1


Tugas Praktikum Konsep Pemrograman

Nama : Kristianes

NRP : 115100056

#include <stdio.h>

#include <conio.h>

void main() {

int a=100, b=10,h;

float c=2, d,e,f,g;

clrscr();

printf("Program prog0303.c\n");

printf("Nilai awal\na=100\nb=10\nc=2\n");

printf("------------------------------------\n\n");

d=a+c/(10+b);

e=(a+b)/2*b;

f=(e+d)/c;

g=(a+c)/(f+b);

h=b%a;

printf("d=%d+%.0f/(10+%d) = %f\n",a,c,b,d);

printf("e=(%d+%d)/2*%d = %f\n",a,b,b,e);

printf("f=(%f+%f)/%.0f = %f\n",e,d,c,f);

printf("g=(%d+%.0f)/(%f+%d) = %f\n",a,c,f,b,g);

printf("h=%d mod %d = %d",b,a,h);

getch();

Institut Teknologi Indonesia 2

You might also like