TUGAS 7.1

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> #include <iomanip> using namespace std; // Nama : Alip Rizki Firnansah // Nim : (3420230040) int main() { cout << "--------------------------------------" << endl; // Define the variables for the table int no, a, b, a_a, b_b; // Print the table header cout << "No" << setw(5) << "A" << setw(5) << "B" << setw(7) << "A*A" << setw(7) << "B*B" << endl; cout << "--------------------------------------" << endl; // Iterate through the rows of the table for (no = 1; no <= 10; no++) { // Calculate the values of A and B a = no * 2; b = no * 3 + 1; // Calculate the values of A*A and B*B a_a = a * a; b_b = b * b; // Print the row of the table cout << setw(2) << no << setw(5) << a << setw(5) << b << setw(7) << a_a << setw(7) << b_b << endl; } cout << "--------------------------------------"; // Print the contact information cout << "\nNama : Alip Rizki Firnansah" << endl; cout << "Email: aliprizkifirnansah1@gmail.com" << endl; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines