1 / 6

Pertemuan Ke-11

Pertemuan Ke-11. IF II UIN SGD. #include &lt; iostream &gt; using namespace std ; int kurang ( int a, int b) { int r; r=a-b; return (r); } int main () { int x=5, y=3, z; z = kurang (7,2); cout &lt;&lt; &quot; Angka Pertama : &quot; &lt;&lt; z &lt;&lt; '<br>';

yoshi-walls
Télécharger la présentation

Pertemuan Ke-11

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Pertemuan Ke-11 IF II UIN SGD

  2. #include <iostream> using namespace std; intkurang(int a, int b) { intr; r=a-b; return (r); } intmain () { int x=5, y=3, z; z = kurang(7,2); cout << "AngkaPertama: " << z << '\n'; cout << "AngkaKedua: " << kurang(7,2) << '\n'; cout << "AngkaKetiga: " << kurang(x,y) << '\n'; z= 4 + kurang(x,y); cout << "AngkaKeempat: " << z << '\n'; system("pause"); return 0; } Latihan FUNGSI

  3. #include <iostream> using namespace std; void duplikat(int& a, int& b, int& c) { a*=2; b*=2; c*=2; } int main () { int x=1, y=3, z=7; duplicate (x, y, z); cout << "x=" << x << ", y=" << y << ", z=" << z; system("pause"); return 0; }

  4. #include <iostream> using namespace std; void MundurMaju (int x, int& mundur, int& maju) { mundur = x-1; maju = x+1; } intmain () { int x=100, y, z; MundurMaju(x, y, z); cout << "Mundur=" << y << ", Maju=" << z; system("pause"); return 0; }

  5. #include<iostream> //f(x)=2x*x+5x using namespace std; float F(float x){ float z = (2*x*x)+(5*x); return z; } intmain(){ float x; cout << "---------------------------\n"; cout << " x f(x) \n"; cout << "---------------------------\n"; x=10.0; while(x<=15.0){ cout << x << " " << F(x)<<"\n"; x=x+0.5; } cout << "---------------------------\n\n"; system("pause"); }

  6. BUAT DALAM 1 PROGRAM: • BUAT PROGRAM DERET FIBONACCI DENGAN FUNGSI • BUAT RUMUS PHYTAGORAS DENGAN FUNGSI • BUAT FUNGSI JARAK: D= • BUAT FUNGSI MENGHITUNG AKAR-AKAR FUNGSI KUADRAT: TUGAS 7

More Related