C++ Input / Output | Practice | GeeksforGeeks

Given two integers A and B. Your task is to return their product.
 
Example 1:
Input:
A = 1, B = 2
Output:
2
Explanation:
Multiplication of 1 and 2 is 2.

 
Example 2:
Input:
A = 8, B = 7
Output:
56
Explanation:
Multiplication of 8 and 7 is 56.
 
Your Task:
You don't need to read input or print anything. Your task is to complete the function multiplication() which takes two integers a and b and returns their product.
 
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
 
Constraints:
0<=a,b<=10000
0
aniketkalawat883 weeks ago
class Solution{   public:   int multiplication(int A, int B){       // code here       int c = A * B;            return c;   }};
0
aniketkalawat88
This comment was deleted.
+1
nallalasumanthreddy3 weeks ago
UPVOTE PYTHON SOLUTION
class Solution:
    def multiplication (ob,A,B):
        # code here 
        return A*B
0
attemptceremony95102 months ago
// { Driver Code Starts#include<bits/stdc++.h> using namespace std;
// } Driver Code Endsclass Solution{   public:   int multiplication(int A, int B){   int mul;   mul=A*B;   return mul;   }};
// { Driver Code Starts.int main() {    int t;   cin>>t;   while(t--)   {       int A, B;       cin >> A >> B;       Solution ob;       cout << ob.multiplication(A,B) << endl;   }   return 0; }  // } Driver Code Ends
0
attemptceremony95102 months ago
// { Driver Code Starts#include<bits/stdc++.h> using namespace std;
// } Driver Code Endsclass Solution{   public:   int multiplication(int A, int B){   int mul;   mul=A*B;   return mul;   }};
// { Driver Code Starts.int main() {    int t;   cin>>t;   while(t--)   {       int A, B;       cin >> A >> B;       Solution ob;       cout << ob.multiplication(A,B) << endl;   }   return 0; }  // } Driver Code Ends
0
sakshamraj2292 months ago
class Solution {
  public:
    int sumOfMatrix(int N, int M, vector<vector<int>> Grid) {
        int sum=0;
        for(int i=0;i<N;i++){
            for(int j=0;j<M;j++){
                sum+=Grid[i][j];
            }
        }
        return sum;
    }
};
0
samkapadia373 months ago
your compiler is not working Properly 
0
b5210143 months ago
#include<stdio.h>
int main()
{
int a= -10,b= 800, c;
c=a*b;
printf("a x b = %d", c);
return 0;
}
 
  
0
aanjalitewari20023 months ago
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
  int a,b,c;
  cout<<"\n enter the  value of a and b;
  cin>>>>b;
  c=a*b;
  cout<<"multiplication of"<<a<<"and"<<b<<"is"<<c<<endl;
  return 0;
0
umerkhayam36433 months ago
.
We strongly recommend solving this problem on your own before viewing its editorial. Do you still
                    want to view the editorial?
 Login to access your submissions. 

Problem


Contest

Reset the IDE using the second button on the top right corner.
Avoid using static/global variables in your code as your code is tested against multiple test cases and these tend to retain their previous values.
Passing the Sample/Custom Test cases does not guarantee the correctness of code. On submission, your code is tested against multiple test cases consisting of all possible corner cases and stress constraints.
You can access the hints to get an idea about what is expected of you as well as the final solution code.
You can view the solutions submitted by other users from the submission tab.