Google Add

Search

C,C++ Program to Multiply two Numbers

Write a C, C++ program to multiply two numbers.

This is a very basic program. In this program you have to multiply two numbers and print their result.

Some other basic programs for practice

Program to add two numbers

Calculate simple interest

Print cube of a number

Print even numbers from 1 to 100

C Program to Multiply two Numbers



# include <stdio.h>

int main() {
 
 int firstnum, secnum , result;
 
 printf("Enter two numbers");
 scanf("%d %d",&firstnum,&secnum);  

    /* Multiply and store the value in result variable. */
    
 result = firstnum * secnum;
 
 printf("Multiplication of two numbers is %d",result);

        return 0;
}

C++ Program to Multiply two Numbers

#include <iostream>
using namespace std;


int main() {
 
 int firstnum, secnum , result;
 
 cout<<"Enter two numbers";
 cin>>firstnum>>secnum;  

       /* Multiply and store the value in result variable. */
    
 result = firstnum * secnum;
 
 cout<<"Multiplication of two numbers is "<<result;
 
 return 0;
}

Output :

Enter two numbers : 4     5

Multiplication of two numbers is  : 20

No comments:

Post a Comment