5 Computer -- Programming II

Write a C program to input a number and print multiplication table of given number.

Write a C program to input a number and print multiplication table of given number.

OUTPUT:

enter the number which u want to get multiplication table 3

Multiplication table is

3 * 1 = 3

3 * 2 = 6

3 * 3 = 9

3 * 4 = 12

3 * 5 = 15

3 * 6 = 18

3 * 7 = 21

3 * 8 = 24

3 * 9 = 27

3 * 10 = 30


#include<stdio.h>

void multiply(int);

int main()

{

    int n;

    printf("enter the number which u want to get multiplication table ");

    scanf("%d",&n);

    multiply(n);

}

void multiply(int n)

{

    int results;

    printf("Multiplication table is\n");

    for(int i=1;i<=10;i++)

    {

       results=n*i; 

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

    }

}


More questions on Programming II

Differentiate between structure and union.

Structures in Cis a user-defined data type available in C that allows to combining of data items of different kinds. Structures are used to represent a record.

Defining a structure:To define astructure, you must use thestructstatement. The struct statement defines a newdata type, with more than or equal to one member. The format of the struct statement is as follows:

struct [structure name] { member definition; member definition; ... member definition; }; (OR) struct [structure name] { member...
Close Open App