SlideShare a Scribd company logo
1 of 5
Kasus 3.3.
Carilah akar-akar persamaan kuadrat
ANALISIS
INPUT : Masukan nilai a,b dan c
PROSES : ada tiga alternatif pilihan dari harga
Yaitu harganya 0, positif atau negatif.
OUTPUT : hasil x1 dan x2
Algoritma Persamaan_Kuadrat
{Menghitung akar-akar persamaan kuadrat Ax^2+Bx+C = 0}
Deklarasi
A, B, C : integer
D : longint
x1, x2 : float
Deskripsi
read (A, B, C)
D  B*B – 4*A*C
if (A = 0) then write (‘Bukan Persamaan Kuadrat’)
else if D > 0 then
x1  -B + sqrt (D)/2*A
x2  -B - sqrt(D)/2*A
else if D = 0 then
x1  -B/2*A
x2  x1
else write (‘Akar imajiner’)
end if
write (x1,x2)
FLOWCHART
C++
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
int main()
{
int A, B, C, D ;
float x1 , x2;
cout <<"Masukan nilai A "<< endl;
cin >> A;
cout <<"Masukan nilai B "<< endl;
cin >> B;
cout <<"Masukan nilai C "<< endl;
cin >> C;
D =B*B-4*A*C;
if (D==0)
{ x1 =-B/2*A;
x2 =x1; }
else
{if (D>0)
{ x1 =(-B+sqrt(D))/2*A;
x2 =(-B-sqrt(D))/2*A;
cout << "hasil" << endl;
cout << "hasil" << endl; }
else
{ cout << "akar imajiner" << endl; }
}
system("PAUSE");
return EXIT_SUCCESS;
}
RUN

More Related Content

What's hot

Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2Dr. Loganathan R
 
Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...
Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...
Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...Fajar Perdana
 
Practica 08 bison
Practica 08 bisonPractica 08 bison
Practica 08 bisonelyescobar
 
Создание новых объектов
Создание новых объектовСоздание новых объектов
Создание новых объектовConstantin Kichinsky
 
Pruebabfs
PruebabfsPruebabfs
PruebabfsJorge
 
Yohan jacobi gaussseidel_analisis
Yohan jacobi gaussseidel_analisisYohan jacobi gaussseidel_analisis
Yohan jacobi gaussseidel_analisisYohan Sidik
 
Program to remove Left factoring
Program to remove Left factoringProgram to remove Left factoring
Program to remove Left factoringShraddha Patel
 
(Meta 4) ejemplo calcular la mitad de un numero dev c++
(Meta 4) ejemplo calcular la mitad de un numero dev c++ (Meta 4) ejemplo calcular la mitad de un numero dev c++
(Meta 4) ejemplo calcular la mitad de un numero dev c++ Eli Diaz
 
Bcsl 033 data and file structures lab s4-3
Bcsl 033 data and file structures lab s4-3Bcsl 033 data and file structures lab s4-3
Bcsl 033 data and file structures lab s4-3Dr. Loganathan R
 

What's hot (19)

Prueba de montecarlo
Prueba de montecarloPrueba de montecarlo
Prueba de montecarlo
 
Manual de practicas
Manual de practicasManual de practicas
Manual de practicas
 
Kasus 3.3 akar
Kasus 3.3 akarKasus 3.3 akar
Kasus 3.3 akar
 
Kelompok 2.6
Kelompok 2.6Kelompok 2.6
Kelompok 2.6
 
Code Snippet
Code SnippetCode Snippet
Code Snippet
 
Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2
 
Simulacion - Algoritmo congruencial cuadratico
Simulacion - Algoritmo congruencial cuadraticoSimulacion - Algoritmo congruencial cuadratico
Simulacion - Algoritmo congruencial cuadratico
 
Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...
Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...
Pendekatan Inversi Linier dengan Matriks Jacobi pada Kasus Perhitungan Hipose...
 
Practica 08 bison
Practica 08 bisonPractica 08 bison
Practica 08 bison
 
Создание новых объектов
Создание новых объектовСоздание новых объектов
Создание новых объектов
 
Kelompok 2.6
Kelompok 2.6Kelompok 2.6
Kelompok 2.6
 
20150415 csharp6.0
20150415 csharp6.020150415 csharp6.0
20150415 csharp6.0
 
Pruebabfs
PruebabfsPruebabfs
Pruebabfs
 
Yohan jacobi gaussseidel_analisis
Yohan jacobi gaussseidel_analisisYohan jacobi gaussseidel_analisis
Yohan jacobi gaussseidel_analisis
 
Program to remove Left factoring
Program to remove Left factoringProgram to remove Left factoring
Program to remove Left factoring
 
Info clasa
Info clasaInfo clasa
Info clasa
 
(Meta 4) ejemplo calcular la mitad de un numero dev c++
(Meta 4) ejemplo calcular la mitad de un numero dev c++ (Meta 4) ejemplo calcular la mitad de un numero dev c++
(Meta 4) ejemplo calcular la mitad de un numero dev c++
 
Bcsl 033 data and file structures lab s4-3
Bcsl 033 data and file structures lab s4-3Bcsl 033 data and file structures lab s4-3
Bcsl 033 data and file structures lab s4-3
 
Programs
ProgramsPrograms
Programs
 

Viewers also liked

Tugas alpro 3.4
Tugas alpro 3.4Tugas alpro 3.4
Tugas alpro 3.41300018047
 
Tugas alpro pertemuan 1 no.2
Tugas alpro pertemuan 1 no.2Tugas alpro pertemuan 1 no.2
Tugas alpro pertemuan 1 no.21300018047
 
Tugas alpro pertemuan 1 no.2
Tugas alpro pertemuan 1 no.2Tugas alpro pertemuan 1 no.2
Tugas alpro pertemuan 1 no.21300018047
 
Tgs ppt alpro no.3
Tgs ppt alpro no.3Tgs ppt alpro no.3
Tgs ppt alpro no.31300018047
 
Tgs ppt alpro no 2
Tgs ppt alpro no 2Tgs ppt alpro no 2
Tgs ppt alpro no 21300018047
 
Entomological field techniques for mosquito and sand fly collection: a field ...
Entomological field techniques for mosquito and sand fly collection: a field ...Entomological field techniques for mosquito and sand fly collection: a field ...
Entomological field techniques for mosquito and sand fly collection: a field ...prakashtu
 
Entomological field techniques for mosquito and sandfly
Entomological field techniques for mosquito and sandflyEntomological field techniques for mosquito and sandfly
Entomological field techniques for mosquito and sandflyprakashtu
 
Mantoux test
Mantoux test Mantoux test
Mantoux test prakashtu
 
HIV epidemiology and pathogenesis
HIV epidemiology and pathogenesis HIV epidemiology and pathogenesis
HIV epidemiology and pathogenesis prakashtu
 
Bacteriological analysis of drinking water by MPN method.
Bacteriological analysis of drinking water by MPN method.Bacteriological analysis of drinking water by MPN method.
Bacteriological analysis of drinking water by MPN method.prakashtu
 

Viewers also liked (17)

Tugas alpro 3.4
Tugas alpro 3.4Tugas alpro 3.4
Tugas alpro 3.4
 
3.6 pp
3.6 pp3.6 pp
3.6 pp
 
3.4 pp
3.4 pp3.4 pp
3.4 pp
 
Tugas alpro pertemuan 1 no.2
Tugas alpro pertemuan 1 no.2Tugas alpro pertemuan 1 no.2
Tugas alpro pertemuan 1 no.2
 
Kontrollansvarig Specialisterna klätterbok
Kontrollansvarig Specialisterna klätterbokKontrollansvarig Specialisterna klätterbok
Kontrollansvarig Specialisterna klätterbok
 
3.5 pp
3.5 pp3.5 pp
3.5 pp
 
Tugas alpro pertemuan 1 no.2
Tugas alpro pertemuan 1 no.2Tugas alpro pertemuan 1 no.2
Tugas alpro pertemuan 1 no.2
 
Tgs ppt alpro no.3
Tgs ppt alpro no.3Tgs ppt alpro no.3
Tgs ppt alpro no.3
 
Tgs ppt alpro no 2
Tgs ppt alpro no 2Tgs ppt alpro no 2
Tgs ppt alpro no 2
 
Entomological field techniques for mosquito and sand fly collection: a field ...
Entomological field techniques for mosquito and sand fly collection: a field ...Entomological field techniques for mosquito and sand fly collection: a field ...
Entomological field techniques for mosquito and sand fly collection: a field ...
 
Entomological field techniques for mosquito and sandfly
Entomological field techniques for mosquito and sandflyEntomological field techniques for mosquito and sandfly
Entomological field techniques for mosquito and sandfly
 
Mantoux test
Mantoux test Mantoux test
Mantoux test
 
HIV epidemiology and pathogenesis
HIV epidemiology and pathogenesis HIV epidemiology and pathogenesis
HIV epidemiology and pathogenesis
 
Filariasis
FilariasisFilariasis
Filariasis
 
Penicillin
PenicillinPenicillin
Penicillin
 
Salmonella
SalmonellaSalmonella
Salmonella
 
Bacteriological analysis of drinking water by MPN method.
Bacteriological analysis of drinking water by MPN method.Bacteriological analysis of drinking water by MPN method.
Bacteriological analysis of drinking water by MPN method.
 

More from 1300018047

Alpro soal kelompok (9 soal) 2
Alpro soal kelompok (9 soal) 2Alpro soal kelompok (9 soal) 2
Alpro soal kelompok (9 soal) 21300018047
 
Tugas alpro 3.5
Tugas alpro 3.5Tugas alpro 3.5
Tugas alpro 3.51300018047
 
Tugas alpro 3.2 alternatif 2
Tugas alpro 3.2 alternatif 2Tugas alpro 3.2 alternatif 2
Tugas alpro 3.2 alternatif 21300018047
 
Tugas alpro 3.2 alternatif 1
Tugas alpro 3.2 alternatif 1Tugas alpro 3.2 alternatif 1
Tugas alpro 3.2 alternatif 11300018047
 
Tugas alpro 3.1
Tugas alpro 3.1Tugas alpro 3.1
Tugas alpro 3.11300018047
 
Tugas alpro 3.1
Tugas alpro 3.1Tugas alpro 3.1
Tugas alpro 3.11300018047
 
Ppt ganjil genap2
Ppt ganjil genap2Ppt ganjil genap2
Ppt ganjil genap21300018047
 
Ppt ganjil genap2
Ppt ganjil genap2Ppt ganjil genap2
Ppt ganjil genap21300018047
 
Ppt ganjil genap2
Ppt ganjil genap2Ppt ganjil genap2
Ppt ganjil genap21300018047
 
Ppt ganjil genap
Ppt ganjil genapPpt ganjil genap
Ppt ganjil genap1300018047
 

More from 1300018047 (12)

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.5 b
2.5 b2.5 b
2.5 b
 
Tugas alpro 3.5
Tugas alpro 3.5Tugas alpro 3.5
Tugas alpro 3.5
 
Tugas alpro 3.2 alternatif 2
Tugas alpro 3.2 alternatif 2Tugas alpro 3.2 alternatif 2
Tugas alpro 3.2 alternatif 2
 
Tugas alpro 3.2 alternatif 1
Tugas alpro 3.2 alternatif 1Tugas alpro 3.2 alternatif 1
Tugas alpro 3.2 alternatif 1
 
Tugas alpro 3.1
Tugas alpro 3.1Tugas alpro 3.1
Tugas alpro 3.1
 
Tugas alpro 3.1
Tugas alpro 3.1Tugas alpro 3.1
Tugas alpro 3.1
 
Ppt ganjil genap2
Ppt ganjil genap2Ppt ganjil genap2
Ppt ganjil genap2
 
Ppt ganjil genap2
Ppt ganjil genap2Ppt ganjil genap2
Ppt ganjil genap2
 
Ppt ganjil genap2
Ppt ganjil genap2Ppt ganjil genap2
Ppt ganjil genap2
 
Ppt ganjil genap
Ppt ganjil genapPpt ganjil genap
Ppt ganjil genap
 

Tugas alpro 3.3

  • 1. Kasus 3.3. Carilah akar-akar persamaan kuadrat ANALISIS INPUT : Masukan nilai a,b dan c PROSES : ada tiga alternatif pilihan dari harga Yaitu harganya 0, positif atau negatif. OUTPUT : hasil x1 dan x2
  • 2. Algoritma Persamaan_Kuadrat {Menghitung akar-akar persamaan kuadrat Ax^2+Bx+C = 0} Deklarasi A, B, C : integer D : longint x1, x2 : float Deskripsi read (A, B, C) D  B*B – 4*A*C if (A = 0) then write (‘Bukan Persamaan Kuadrat’) else if D > 0 then x1  -B + sqrt (D)/2*A x2  -B - sqrt(D)/2*A else if D = 0 then x1  -B/2*A x2  x1 else write (‘Akar imajiner’) end if write (x1,x2)
  • 4. C++ #include <iostream> #include <string> #include <math.h> using namespace std; int main() { int A, B, C, D ; float x1 , x2; cout <<"Masukan nilai A "<< endl; cin >> A; cout <<"Masukan nilai B "<< endl; cin >> B; cout <<"Masukan nilai C "<< endl; cin >> C; D =B*B-4*A*C; if (D==0) { x1 =-B/2*A; x2 =x1; } else {if (D>0) { x1 =(-B+sqrt(D))/2*A; x2 =(-B-sqrt(D))/2*A; cout << "hasil" << endl; cout << "hasil" << endl; } else { cout << "akar imajiner" << endl; } } system("PAUSE"); return EXIT_SUCCESS; }
  • 5. RUN