Sunday, July 22, 2018

Program C++ Pertukaran Dua Bilangan | Algoritma Pemrograman

ALGORITMA
Program PertukaranDuaBilangan
Deklarasi
   a,b,c:integer
Algoritma
   read (a,b)
    c<-a
    a<-b
    b<-c
   write (a,b)

CODING
#include<iostream>
using namespace std;
int main() {
    int a,b,c;
    cout<<"a=";
    cin>>a;
    cout<<"b=";
    cin>>b;
    c=a;
    a=b;
    b=c;
    cout<<" "<<endl;
    cout<<"a="<<a<<endl;
    cout<<"b="<<b<<endl;
    cout<<" "<<endl;
    system("PAUSE");
}



KELUARAN 

 

No comments:

Post a Comment