Write a C program to multiply two numbers using plus operator

By | 03.11.2016

Multiply two numbers using plus operator


Write a C program to multiply two numbers using plus operator. Here’s simple program to multiply two numbers using plus operator in C Programming Language.


Given two numbers as input from user, we have to multiply them without using arithmetic operators like * and +. In this program we will multiply two numbers by repetitive addition. In other words, A X B is same as A + A + A… (B times).

For Example : : 

5 X 4 = 5 + 5 + 5 + 5 = 20


Below is the source code for C program to multiply two numbers using plus operator which is successfully compiled and run on Windows System to produce desired output as shown below :


SOURCE CODE : :


/*  C program to multiply two numbers using plus operator  */

#include <stdio.h>

int main()
{
    int a,b;
    int mul,i;

    printf("Enter first number:: ");
    scanf("%d",&a);
    printf("\nEnter second number:: ");
    scanf("%d",&b);

    mul=0;
    for(i=1;i<=b;i++){
        mul += a;
    }
    printf("\nMultiplication of %d and %d is: %d\n",a,b,mul);
     return 0;
}

OUTPUT : :


/*  C program to multiply two numbers using plus operator  */

Enter first number:: 6

Enter second number:: 7

Multiplication of 6 and 7 is: 42

Above is the source code for C program to multiply two numbers using plus operator which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

5 2 votes
Article Rating
Category: Basic Programs C Programming Number Programs Tags:

About Tunde A

My name is Tunde Ajetomobi, a Tech Enthusiast and Growth Hacker. I enjoy creating helpful content that solves problem across different topics. Codezclub is my way of helping young aspiring programmers and students to hone their skills and find solutions on fundamental programming languages.

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments