๐Ÿ’ป
B.TECH I YEAR โ€ข I SEMESTER โ€ข R25

Programming for Problem Solving - Lab Manual

C Programming Laboratory โ€ข Program Solution

๐Ÿ“˜ R25 Regulation ๐ŸŽ“ I Year ๐Ÿ“š I Semester ๐Ÿ’ป C Programming ๐Ÿงช Lab Program
Selected Program

Write a program that prints a multiplication table for a given number and the number of rows inthe table. For example, for a number 5 and rows = 3, the output should be: 5 x 1 = 5 5 x 2 = 10 5 x 3 = 15.

โ† All Lab Programs

Write a program that prints a multiplication table for a given number and the number of rows inthe table. For example, for a number 5 and rows = 3, the output should be:
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15.

Algorithm

start
	step1: Read a,r
	step2: for i := 1 to r step 1 do
	step3: 	Print a * i
stop

Flowchart
flowchart for multiplication table for a given number in c

C Programming
// multiplication table for a given number and the number of rows inthe table 

#include <stdio.h>
int main()
{
	int a,r,i;
	printf("Enter an integer number : ");
	scanf("%d",&a);
	printf("Enter number of rows : ");
	scanf("%d",&r);
	for(i=1;i<=r;i++)
		printf("%d * %2d = %2d\n",a,i,a*i);
	return(0);
}

OUTPUT
Enter an integer number : 6
Enter number of rows : 10
6 *  1 =  6
6 *  2 = 12
6 *  3 = 18
6 *  4 = 24
6 *  5 = 30
6 *  6 = 36
6 *  7 = 42
6 *  8 = 48
6 *  9 = 54
6 * 10 = 60

๐Ÿ’ป Run This C Program

Write a program that prints a multiplication table for a given number and the number of rows inthe table. For example, for a number 5 and rows = 3, the output should be: 5 x 1 = 5 5 x 2 = 10 5 x 3 = 15.
The selected C program is loaded automatically. Edit the code, provide input through STDIN and click Run.

The compiler is embedded using OneCompiler. Your program runs in the embedded C environment; Study Glance does not execute C code directly on your web server.
โ† Back to PPS Lab Programs ๐Ÿ“š All Lab Manuals