SlideShare une entreprise Scribd logo
1  sur  4
Kasus 3.3.
Carilah akar-akar persamaan kuadrat
Analisis:
Input : a,b,c
Proses : mencari akar-akar persamaan kuadrat.
Output : akar-akar kuadrat
Deklarasi:
a,b,c : integer{Input}
disk : longint{output}
x1,x2 : real{output}
Deskripsi
read(a,b,c)
disk<--b*b-4a*c
if (a=0) then write('Bukan persamaan kuadrat')
else if disk>0 then
x1<---(-b)+sqrt(disk)/2*a
x2<---(-b)-sqrt(disk)/2*a
else if disk=0 then
x1<---(-b)/2*a
x2<---x1
else write('Akar Imajiner')
end if
· write(x1,x2)
flowchart
 #include<cstdlib>
#include<iostream>
#include <conio.h>
#include<math.h>
using namespace std;
class persamaan{
public:
void persamaan_kuadrat();
float rumus();
private:
int x,y,z;
float x1,x2;
float disk;
};
void persamaan::persamaan_kuadrat(){
cout<<"masukkan nilai A :";
cin>>x;
cout<<"masukkan nilai B :";
cin>>y;
cout<<"masukkan nilai C :";
cin>>z;
}
float persamaan::rumus(){
disk=y*y-4*x*z;
if (disk>0)
{
cout<<"Diskriminan="<<disk<<" Maka akar-akarnya adalah:"<<endl;
x1=(-y+(sqrt(disk)))/(2*x);
cout<<"x1 :"<<x1;
cout<<endl;
x2=(-y-(sqrt(disk)))/(2*x);
cout<<"x2 :"<<x2;
}
else if(disk=0)
{
cout<<"Diskriminan="<<disk<<" Maka akar-akarnya adalah:"<<endl;
x1=-y/2*x;
cout<<"x1 :"<<x1;
cout<<endl;
x2=x1;
cout<<"x2 :"<<x2;
}
else
cout<<"akar imajiner";
}
int main(int argc, char *argv[])
{
persamaan X;
X.persamaan_kuadrat();
X.rumus();
return 0;
}

Contenu connexe

Tendances (17)

Como crear una matriz de 3x3 con c++ con menu
Como crear una matriz de 3x3 con c++ con menu Como crear una matriz de 3x3 con c++ con menu
Como crear una matriz de 3x3 con c++ con menu
 
Some logics
Some logicsSome logics
Some logics
 
Mongophilly cool-features-2011-04-26
Mongophilly cool-features-2011-04-26Mongophilly cool-features-2011-04-26
Mongophilly cool-features-2011-04-26
 
Zadatak
ZadatakZadatak
Zadatak
 
Kruskal algorithm
Kruskal algorithmKruskal algorithm
Kruskal algorithm
 
python-geohex
python-geohexpython-geohex
python-geohex
 
The Flavor of TypeScript
The Flavor of TypeScriptThe Flavor of TypeScript
The Flavor of TypeScript
 
Taller full calculo diferencial
Taller full calculo diferencialTaller full calculo diferencial
Taller full calculo diferencial
 
Event loops in java script 01 - stack
Event loops in java script 01 - stackEvent loops in java script 01 - stack
Event loops in java script 01 - stack
 
Program brian
Program brianProgram brian
Program brian
 
contoh Program C++ tentang fungsi for
contoh Program C++ tentang fungsi forcontoh Program C++ tentang fungsi for
contoh Program C++ tentang fungsi for
 
[KOSSA] C++ Programming - 14th Study - template
[KOSSA] C++ Programming - 14th Study - template[KOSSA] C++ Programming - 14th Study - template
[KOSSA] C++ Programming - 14th Study - template
 
Passato
PassatoPassato
Passato
 
Dsa 1
Dsa 1Dsa 1
Dsa 1
 
Los fantastico
Los fantasticoLos fantastico
Los fantastico
 
Node.JS
Node.JSNode.JS
Node.JS
 
Convert bilangan
Convert bilanganConvert bilangan
Convert bilangan
 

En vedette

Kaw061000..c75.eng.2.0
Kaw061000..c75.eng.2.0Kaw061000..c75.eng.2.0
Kaw061000..c75.eng.2.0
JAVIER ORÁN
 
명함(22 june2013) Han Woo Park Name Card Update
명함(22 june2013) Han Woo Park Name Card Update명함(22 june2013) Han Woo Park Name Card Update
명함(22 june2013) Han Woo Park Name Card Update
Han Woo PARK
 
Целеполагание (март 2014)
Целеполагание (март 2014)Целеполагание (март 2014)
Целеполагание (март 2014)
RnD_SM
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
vjjokerrr
 
Diccionario mecanica de rocas
Diccionario   mecanica de rocasDiccionario   mecanica de rocas
Diccionario mecanica de rocas
Joel Tito
 

En vedette (20)

Kasus 3.5
Kasus 3.5Kasus 3.5
Kasus 3.5
 
《莲花海》(33) 智慧的运用-智慧的修行方向(33)-如何可以直接提升心的功用及德行-如何可以直接或间接地提升智慧-如何可以直接连结诸佛菩萨-如何可以直...
《莲花海》(33) 智慧的运用-智慧的修行方向(33)-如何可以直接提升心的功用及德行-如何可以直接或间接地提升智慧-如何可以直接连结诸佛菩萨-如何可以直...《莲花海》(33) 智慧的运用-智慧的修行方向(33)-如何可以直接提升心的功用及德行-如何可以直接或间接地提升智慧-如何可以直接连结诸佛菩萨-如何可以直...
《莲花海》(33) 智慧的运用-智慧的修行方向(33)-如何可以直接提升心的功用及德行-如何可以直接或间接地提升智慧-如何可以直接连结诸佛菩萨-如何可以直...
 
《莲花海》(32) 智慧的运用-智慧的修行方向(32)-如何方可为即将逝世的亲人续命?-如何以四种层面救助病人-供灯及悬挂经幡所引发的不可思议奇迹-啤吗哈...
《莲花海》(32) 智慧的运用-智慧的修行方向(32)-如何方可为即将逝世的亲人续命?-如何以四种层面救助病人-供灯及悬挂经幡所引发的不可思议奇迹-啤吗哈...《莲花海》(32) 智慧的运用-智慧的修行方向(32)-如何方可为即将逝世的亲人续命?-如何以四种层面救助病人-供灯及悬挂经幡所引发的不可思议奇迹-啤吗哈...
《莲花海》(32) 智慧的运用-智慧的修行方向(32)-如何方可为即将逝世的亲人续命?-如何以四种层面救助病人-供灯及悬挂经幡所引发的不可思议奇迹-啤吗哈...
 
Cvs
CvsCvs
Cvs
 
《莲花海》(43) 给上师的信:我的修行感想与祈请(3)及我的修行感想与祈请(4)-敦珠佛学会
《莲花海》(43) 给上师的信:我的修行感想与祈请(3)及我的修行感想与祈请(4)-敦珠佛学会《莲花海》(43) 给上师的信:我的修行感想与祈请(3)及我的修行感想与祈请(4)-敦珠佛学会
《莲花海》(43) 给上师的信:我的修行感想与祈请(3)及我的修行感想与祈请(4)-敦珠佛学会
 
regarder Man of steel 2013 sur putlocker
regarder Man of steel 2013 sur putlockerregarder Man of steel 2013 sur putlocker
regarder Man of steel 2013 sur putlocker
 
Kaw061000..c75.eng.2.0
Kaw061000..c75.eng.2.0Kaw061000..c75.eng.2.0
Kaw061000..c75.eng.2.0
 
POP-SCREEN-TEE-logo
POP-SCREEN-TEE-logoPOP-SCREEN-TEE-logo
POP-SCREEN-TEE-logo
 
《莲花海》(40) 修行重点金句-修行重点与偏差(四.八)-移喜泰贤金刚上师及啤吗哈尊金刚上师-敦珠佛学会
《莲花海》(40) 修行重点金句-修行重点与偏差(四.八)-移喜泰贤金刚上师及啤吗哈尊金刚上师-敦珠佛学会《莲花海》(40) 修行重点金句-修行重点与偏差(四.八)-移喜泰贤金刚上师及啤吗哈尊金刚上师-敦珠佛学会
《莲花海》(40) 修行重点金句-修行重点与偏差(四.八)-移喜泰贤金刚上师及啤吗哈尊金刚上师-敦珠佛学会
 
《蓮花海》(34) 祖師傳記-蓮師八變(八)-啤嗎森巴華(27)-蓮師對有關《巖藏寶藏》以及“巖取者”等之重要開示(一)-移喜泰賢金剛上師(著)-敦珠佛學會
《蓮花海》(34) 祖師傳記-蓮師八變(八)-啤嗎森巴華(27)-蓮師對有關《巖藏寶藏》以及“巖取者”等之重要開示(一)-移喜泰賢金剛上師(著)-敦珠佛學會《蓮花海》(34) 祖師傳記-蓮師八變(八)-啤嗎森巴華(27)-蓮師對有關《巖藏寶藏》以及“巖取者”等之重要開示(一)-移喜泰賢金剛上師(著)-敦珠佛學會
《蓮花海》(34) 祖師傳記-蓮師八變(八)-啤嗎森巴華(27)-蓮師對有關《巖藏寶藏》以及“巖取者”等之重要開示(一)-移喜泰賢金剛上師(著)-敦珠佛學會
 
《蓮花海》(37) 祖師傳記-蓮師八變(七)-啤嗎森巴華(30)-蓮師對有關《岩藏寶藏》以及“岩取者”等之重要開示(四)-移喜泰賢金剛上師(著)-敦珠佛學會
《蓮花海》(37) 祖師傳記-蓮師八變(七)-啤嗎森巴華(30)-蓮師對有關《岩藏寶藏》以及“岩取者”等之重要開示(四)-移喜泰賢金剛上師(著)-敦珠佛學會《蓮花海》(37) 祖師傳記-蓮師八變(七)-啤嗎森巴華(30)-蓮師對有關《岩藏寶藏》以及“岩取者”等之重要開示(四)-移喜泰賢金剛上師(著)-敦珠佛學會
《蓮花海》(37) 祖師傳記-蓮師八變(七)-啤嗎森巴華(30)-蓮師對有關《岩藏寶藏》以及“岩取者”等之重要開示(四)-移喜泰賢金剛上師(著)-敦珠佛學會
 
《莲花海》(30) 生命的终极关爱-临终关顾系列 (6)-癌症病人的宁养护理(2)-癌症的病症-移喜泰贤金刚上师及啤吗哈尊金刚上师
《莲花海》(30) 生命的终极关爱-临终关顾系列 (6)-癌症病人的宁养护理(2)-癌症的病症-移喜泰贤金刚上师及啤吗哈尊金刚上师《莲花海》(30) 生命的终极关爱-临终关顾系列 (6)-癌症病人的宁养护理(2)-癌症的病症-移喜泰贤金刚上师及啤吗哈尊金刚上师
《莲花海》(30) 生命的终极关爱-临终关顾系列 (6)-癌症病人的宁养护理(2)-癌症的病症-移喜泰贤金刚上师及啤吗哈尊金刚上师
 
명함(22 june2013) Han Woo Park Name Card Update
명함(22 june2013) Han Woo Park Name Card Update명함(22 june2013) Han Woo Park Name Card Update
명함(22 june2013) Han Woo Park Name Card Update
 
Thanet chardter
Thanet chardterThanet chardter
Thanet chardter
 
《莲花海》(35) 祖师传记-莲师八变(八)-啤吗森巴华(28)-莲师对有关《岩藏宝藏》以及“岩取者”等之重要开示(二)-移喜泰贤金刚上师(着)-敦珠佛学会
《莲花海》(35) 祖师传记-莲师八变(八)-啤吗森巴华(28)-莲师对有关《岩藏宝藏》以及“岩取者”等之重要开示(二)-移喜泰贤金刚上师(着)-敦珠佛学会《莲花海》(35) 祖师传记-莲师八变(八)-啤吗森巴华(28)-莲师对有关《岩藏宝藏》以及“岩取者”等之重要开示(二)-移喜泰贤金刚上师(着)-敦珠佛学会
《莲花海》(35) 祖师传记-莲师八变(八)-啤吗森巴华(28)-莲师对有关《岩藏宝藏》以及“岩取者”等之重要开示(二)-移喜泰贤金刚上师(着)-敦珠佛学会
 
Целеполагание (март 2014)
Целеполагание (март 2014)Целеполагание (март 2014)
Целеполагание (март 2014)
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
 
Capacatalogo
CapacatalogoCapacatalogo
Capacatalogo
 
Liberty logo 3
Liberty logo 3Liberty logo 3
Liberty logo 3
 
Diccionario mecanica de rocas
Diccionario   mecanica de rocasDiccionario   mecanica de rocas
Diccionario mecanica de rocas
 

Plus de istwiariindri (18)

3.6 pp
3.6 pp3.6 pp
3.6 pp
 
3.5 pp
3.5 pp3.5 pp
3.5 pp
 
3.4 pp
3.4 pp3.4 pp
3.4 pp
 
Alpro soal kelompok (9 soal) 2
Alpro soal kelompok (9 soal) 2Alpro soal kelompok (9 soal) 2
Alpro soal kelompok (9 soal) 2
 
Alpro soal kelompok (9 soal) 2
Alpro soal kelompok (9 soal) 2Alpro soal kelompok (9 soal) 2
Alpro soal kelompok (9 soal) 2
 
2.7 a
2.7 a2.7 a
2.7 a
 
2.7 a
2.7 a2.7 a
2.7 a
 
2.5 b
2.5 b2.5 b
2.5 b
 
Kasus 3.5
Kasus 3.5Kasus 3.5
Kasus 3.5
 
Kasus 3.5
Kasus 3.5Kasus 3.5
Kasus 3.5
 
Kasus 3.5
Kasus 3.5Kasus 3.5
Kasus 3.5
 
3.4 kasus
3.4 kasus3.4 kasus
3.4 kasus
 
Alternatif 2 terbesar
Alternatif 2 terbesarAlternatif 2 terbesar
Alternatif 2 terbesar
 
Alternatif 1 3.2
Alternatif 1 3.2Alternatif 1 3.2
Alternatif 1 3.2
 
Presentation2
Presentation2Presentation2
Presentation2
 
Presentation1
Presentation1Presentation1
Presentation1
 
latihan SAP
latihan SAPlatihan SAP
latihan SAP
 
Sap 1
Sap 1Sap 1
Sap 1
 

Kasus 3.3 akar

  • 1. Kasus 3.3. Carilah akar-akar persamaan kuadrat Analisis: Input : a,b,c Proses : mencari akar-akar persamaan kuadrat. Output : akar-akar kuadrat Deklarasi: a,b,c : integer{Input} disk : longint{output} x1,x2 : real{output}
  • 2. Deskripsi read(a,b,c) disk<--b*b-4a*c if (a=0) then write('Bukan persamaan kuadrat') else if disk>0 then x1<---(-b)+sqrt(disk)/2*a x2<---(-b)-sqrt(disk)/2*a else if disk=0 then x1<---(-b)/2*a x2<---x1 else write('Akar Imajiner') end if · write(x1,x2)
  • 4.  #include<cstdlib> #include<iostream> #include <conio.h> #include<math.h> using namespace std; class persamaan{ public: void persamaan_kuadrat(); float rumus(); private: int x,y,z; float x1,x2; float disk; }; void persamaan::persamaan_kuadrat(){ cout<<"masukkan nilai A :"; cin>>x; cout<<"masukkan nilai B :"; cin>>y; cout<<"masukkan nilai C :"; cin>>z; } float persamaan::rumus(){ disk=y*y-4*x*z; if (disk>0) { cout<<"Diskriminan="<<disk<<" Maka akar-akarnya adalah:"<<endl; x1=(-y+(sqrt(disk)))/(2*x); cout<<"x1 :"<<x1; cout<<endl; x2=(-y-(sqrt(disk)))/(2*x); cout<<"x2 :"<<x2; } else if(disk=0) { cout<<"Diskriminan="<<disk<<" Maka akar-akarnya adalah:"<<endl; x1=-y/2*x; cout<<"x1 :"<<x1; cout<<endl; x2=x1; cout<<"x2 :"<<x2; } else cout<<"akar imajiner"; } int main(int argc, char *argv[]) { persamaan X; X.persamaan_kuadrat(); X.rumus(); return 0; }