Loops – Arithmetic – Problem #1

IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive

Difficulty: Medium

Problem Statement

A user executes a program and it asks to enter an integer. When s(he) enters 7 then the program prints the following 7*7 square matrix. Write a C program which can read any positive integer (<=7) and perform this. Use loop to execute this operation and achieve proper alignment. 1 2 3 4 5. 6. 7 2 4 12 48 240 1440 10080 3 6 18 72 360 2160 15120 4 8 24 96 480 2880 20160 5 10 30 120 600 3600 25100 6 12 36 144 720 4320 30240 7 14 42 168 840 5040 35280

Back to Lab Problems
Loops/Arithmetic/Problem #1

Lab Problem Statement

Specifications & Problem DetailsIIT Kharagpur PDS Archive
Loading question...

Interactive C Compiler · Problem #1

WASM In-Browser

Runs directly on your machine · Zero remote server dependency

Compiler downloads on first Run (large, saved in your browser after that)
main.cCtrl + Enter to run
1
2
3
4
5
6
7
Input (stdin)given to scanf / cin
Output

Output appears here. Press Run to compile and execute.