Algorithm
Problem
Harsh was recently gifted a book consisting of pages. Each page contains exactly 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.
Input Format
- The first line of input will contain a single integer , denoting the number of test cases.
- Each test case consists of two space-separated integers on a single line, and — the number of pages and the number of words on each page, respectively.
Output Format
For each test case, output on a new line, the total number of words in the book.
Constraints
Sample 1:
4 1 1 4 2 2 4 95 42
1 8 8 3990
Explanation:
Test case : The book consists of only page, and each page has only word. Hence, the total number of words is .
Test case : The book consists of pages, and each page has words. Hence, the total number of words is .
Test case : The book consists of pages, and each page has words. Hence, the total number of words is .
Test case : The book consists of pages, and each page has words. Hence, the total number of words is .
Code Examples
AdvertisementsDemonstration
CodeCherf solution CNTWORD - Counting Words solution in C,C++