Mata kuliah C++ konversi angka

#include <vcl.h>
looping
====================

#pragma hdrstop
#include <iostream.h>
#include <conio.h>

//—————————————-

#pragma argsused
int main(int argc, char* argv[])
{
int b=2,c=4;
for( int a=5;a<=7;a=a+2)
{cout<<“a=” <<a<<endl;
cout<<“b=” <<b<<endl;
cout<<“c=” <<c<<endl;
b=b+2;
c=c+3;}
getch();
return 0;
}

hasilnya

a=5
b=2
c=4
a=7
b=4
c=7

#include <vcl.h>
#pragma hdrstop
#include <iostream.h>
#include <conio.h>

//————————————-

#pragma argsused
int main(int argc, char* argv[])
{
int q=10,z=5;
for( int r=2;r<=5;r=r+3)
{cout<<“q=”<<q<<endl;
cout<<“r=”<<r<<endl;
cout<<“z=”<<z<<endl;
q=q-3;
z=z+3;}
getch();
return 0;
}

hasilnya

q=10
r=2
z=5
q=7
r=5
z=8

#include <vcl.h>
#pragma hdrstop
#include <iostream.h>
#include <conio.h>

//————————————-

#pragma argsused
int main(int argc, char* argv[])
{
int p=5,z=10;
for( int r=2;r<=5;r=r+2)
{cout<<“p=”<<p<<endl;
cout<<“r=”<<r<<endl;
cout<<“z=”<<z<<endl;
p=p-1;
z=z-6;}
getch();
return 0;
}

hasilnya

p=5
q=2
r=10
p=4
q=4
r=4

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: