0% found this document useful (0 votes)
19 views

Program: Multiplication Table of A Given Number: #Include

The document contains code for two C programs. The first program takes a number as input and prints out its multiplication table up to 10. The second program prints a pyramid pattern of repeating numbers, with an increasing number of repeats for each line and decreasing spacing between numbers. It uses nested for loops and formatting to control number of repeats and alignment of output.

Uploaded by

skartchan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Program: Multiplication Table of A Given Number: #Include

The document contains code for two C programs. The first program takes a number as input and prints out its multiplication table up to 10. The second program prints a pyramid pattern of repeating numbers, with an increasing number of repeats for each line and decreasing spacing between numbers. It uses nested for loops and formatting to control number of repeats and alignment of output.

Uploaded by

skartchan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Program: Multiplication table of a given number

#include <stdio.h>

int main() {

int num, i = 1

printf("\n Enter any Number:");

scanf("%d", &num);

printf("Multiplication table of %d: \n", num);

while (i <= 10) {

printf("\n %d x %d = %d", num, i, num * i);

i++;

return 0;

1.

Write C program to print the following pattern:


1

2 2

3 3 3

4 4 4 4

5 5 5 5 5

Program:
#include<stdio.h>

int main() {

int i, j, k, c = 5;

for (i = 1; i <= 5; i++) {

/* k is taken for spaces */

for (k = 1; k <= c; k++) {

/* blank space */

printf(" ");

for (j = 1; j <= i; j++) {

/* %2d ensures that the number is printed in

two spaces for alignment and the numbers are printed in the order. */

printf("%2d", i);

printf("\n");

/*c is decremented by 1 */

c--;

return 0;

You might also like