TUGAS7.1

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <iomanip> // Untuk format output int main() { // Header tabel std::cout << "--------------------------------------------" << std::endl; std::cout << " No A B A*A B*B" << std::endl; std::cout << "--------------------------------------------" << std::endl; // Loop untuk menghasilkan baris tabel for (int i = 1; i <= 10; ++i) { int A = 2 * i; // Nilai A int B = 1 + i+A; // Nilai B int A_squared = A * A; // A*A int B_squared = B * B; // B*B // Cetak hasil dalam format tabel std::cout << std::setw(3) << i << " " << std::setw(3) << A << " " << std::setw(3) << B << " " << std::setw(5) << A_squared << " " << std::setw(5) << B_squared << std::endl; } // Footer tabel std::cout << "--------------------------------------------" << std::endl; std::cout << "Nama : MUHAMAD NIBROOS NAJIB" << std::endl; std::cout << "Email : MUHAMADNIBROOS@GMAIL.COM" << std::endl; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines