Penggunaan Pengulangan For Bersarang pada Bahasa C++

Latihan Modul 6.4

Nama : Haidi

No.Reg : 49031064

  1. Ubah format tampilan pada modul di atas dengan menggunakan pengulangan for bersarang, dengan format tampilan sbb :

modul6.4

  1. // Modul6.4.cpp : Defines the entry point for the console application.
  2. //
  3. #include “stdafx.h”
  4. #include <iostream>
  5. using namespace std;
  6. int _tmain(int argc, _TCHAR* argv[])
  7. {
  8.        for (int j=0; j<=10; j++){
  9.               for (int k=0; k<=j; k++){
  10.                      cout << k+j <<‘ ‘;
  11.               }
  12.               cout <<“\n”;
  13.        }
  14.        system(“pause”);
  15.               return 0;
  16. }

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s