Purpose: The purpose of this lab is to become familiar with the use of nested lo
ID: 3563964 • Letter: P
Question
Purpose: The purpose of this lab is to become familiar with the use of nested loops. Procedure: Write a C program that will generate a 5 X 5 multiplication table starting with the number of the users choice. Your program will print the table and then ask the user if they would like to generate another table. Example: If the user enters 4 the program will print: 4 5 6 7 8 4 16 20 24 28 32 5 20 25 30 35 40 6 24 30 36 42 48 7 28 35 42 49 56 8 32 40 48 56 64 Suggestions: Start by working through the calculations to determine: Variable types required. Possible program structures. Decide how you want the output to look. What formatting will be required? Write pseudo code that will accomplish the tasks required Report: A copy of your source code. A flowchart of your program.Explanation / Answer
#include<stdio.h>
int main(){
int i=0,j=0,m=0,k=0;/*INITIALIZING CHARACTERS*/
int num =0;
printf("Enter num : ");
scanf("%d",&num);
for(i=num;i<num+5;i++){
printf(" %d",i);
}
printf(" ");/*PRINTING NEW LINE*/
for(j=num;j<num+5;j++){
printf("%d",j);/*PRINTING VALUE OF j*/
for(k=num;k<num+5;k++){
m= k*j;
printf(" %d",m);/*THIS WILL PRINT IN THE MULTIPLICATION TABLE A NUMBER WHICH IS THE PRODUCT OF ELEMENTS OF THE CONCECUTIVE ROW AND
COLUMN*/
}
printf(" ");/*PRINTING NEW LINE*/
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.