Looping [1]

Kasus-kasus dari fathur.wordpress.com

no.2 betul tidak ?!



/*----------------------------
 Looping [1]
 Nama : Muhammad Akbar Sidiq
 kelas: 1B-JTK Polban '09
 file : Loopint_1.cpp
----------------------------*/

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

void main()
{
	int i=1,j, x=2 ;
	float bil ;

	while (1>0)
	{
		clrscr() ;
		cout << "Program Buatan Sidiq loh:D\n\n" ;
		cout << "Posisi awal    : " ;
		cin >> bil ;
		cout << "Jumlah Looping : " ;
		cin >> j ;
		cout << "HASIL          : " ;

		if (j>0)
		{
			while (i<=j)
			{
				cout << bil << ", " ;
				bil=bil+x ;
				x=x+1 ;
				i=i+1 ;
			}
			cout << "\b\b" ;
		}
		else
		{
			cout << "\n\n~~~~JUMLAH LOOPING TIDAK BOLEH NEGATIF COY !!!~~~~" ;
		}
		cout << "\n\n#KETIK SEMBARANG UTK MENGULANG#" ;
		getche() ;
	}
}

3 comments on “Looping [1]

Leave a comment