Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Harsh was recently gifted a book consisting of N pages. Each page contains exactly M words printed on it. As he was bored, he decided to count the number of words in the book.
Help Harsh find the total number of words in the book.
For each test case, output on a new line, the total number of words in the book.
Input: 4
1 1
4 2
2 4
95 42
Output: 1
8
8
3990
Test case 1: The book consists of only 1 page, and each page has only 1 word. Hence, the total number of words is 1.
Test case 2: The book consists of 4 pages, and each page has 2 words. Hence, the total number of words is 2+2+2+2=8.
Test case 3: The book consists of 2 pages, and each page has 4 words. Hence, the total number of words is 4+4=8.
Test case 4: The book consists of 95 pages, and each page has 42 words. Hence, the total number of words is 3990.
#include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int N,M;
cin>>N>>M;
cout<<N*M<<endl;
}
return 0;
}
# cook your dish here
t=int(input())
while t!=0:
n,m=map(int,input().split())
print(n*m)
t-=1
import java.util.*;
import java.lang.*;
import java.io.*;
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int i=0;i<T;i++){
int m = sc.nextInt();
int n = sc.nextInt();
System.out.println(m*n);
}
}
}
In our experience, we suggest you solve this Counting Words CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Counting Words CodeChef Solution
I hope this Counting Words CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>