WAP_A03: . Write a program that prints a multiplication table for a given number and the number of rows in the table.|| Simple Numeric Problems
Algorithm
start step1: Read a,r step2: for i := 1 to r step 1 do step3: Print a * i stop |
WAP_A03: C Lab Program
// multiplication table for a given number and the number of rows in the 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 |
For all 2026 published articles list: click here
...till the next post, bye-bye & take care.
No comments:
Post a Comment