C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

C++

A robot can type 300 letters per minute. The given program takes the text input time (in minutes). Task Complete the code to calculate and output the number of letters that will be typed in a given time. Sample Input 20 Sample Output 6000 Hint To calculate the length of the text, you need to multiply the time by a count (letters per minute). Attempt in comments

11th Sep 2021, 2:17 PM
Mando
Mando - avatar
18 Answers
+ 3
Tanvir, you forgot to declare the variable "result" Corrected code: #include <iostream> using namespace std; int main() { int speed = 300; //speed of the robot int time, result; //declare variables cin >> time; //input the time result = time * speed; cout << result; //output the result return 0; }
11th Sep 2021, 3:33 PM
Chris
+ 2
include <iostream> using namespace std; int main() { int computer = 300; int time; cin >> time ; result = computer * time; cout << result ; return 0; } Does this work??
11th Sep 2021, 2:27 PM
Tanvir Salehin
Tanvir Salehin - avatar
+ 2
#include <iostream> int result = computer * time;
11th Sep 2021, 2:36 PM
Simba
Simba - avatar
+ 1
Doesnt work though
11th Sep 2021, 2:22 PM
Mando
Mando - avatar
+ 1
Nope
11th Sep 2021, 2:29 PM
Mando
Mando - avatar
+ 1
Yeah... That's it.. Thanks Simba
11th Sep 2021, 2:37 PM
Tanvir Salehin
Tanvir Salehin - avatar
+ 1
#include<iostream> using namespace std; int main () { int n; // n is given time cin>>n; cout<<n*300; return 0; }
12th Sep 2021, 2:29 PM
Shivani Kalghatkar
Shivani Kalghatkar - avatar
+ 1
#include<iostream> int main() { int n = 300; int time; cin>>time; cout<<n*time; return 0; }
12th Sep 2021, 6:34 PM
Sunnie23
Sunnie23 - avatar
0
include <iostream> using namespace std; int main() { int computer = 300; int time = 1; cin >> time * computer; cout << time ; return 0; }
11th Sep 2021, 2:17 PM
Mando
Mando - avatar
0
Yay... You made the solution urself...
11th Sep 2021, 2:18 PM
Tanvir Salehin
Tanvir Salehin - avatar
0
Oh... I didn't test that btw... 😅😅😅
11th Sep 2021, 2:23 PM
Tanvir Salehin
Tanvir Salehin - avatar
0
What's the error..?? I mean, can u please tell me.. I am not in a position to test it... Sorry Pardon my poor English.... 😩😩
11th Sep 2021, 2:34 PM
Tanvir Salehin
Tanvir Salehin - avatar
0
Lothar Please correct me... I am new to cpp
11th Sep 2021, 3:34 PM
Tanvir Salehin
Tanvir Salehin - avatar
0
Thanks Chris
11th Sep 2021, 3:34 PM
Tanvir Salehin
Tanvir Salehin - avatar
0
#include < iostream> Using namespace std; Int main() { Double time,letters; /*Double will be used because time can be in hours and minutes both */ Cin>>time ; Letters = 300* time ; Cout <<letters; Return 0 ; }
13th Sep 2021, 9:41 AM
Adarsh Singh
Adarsh Singh - avatar
0
int count = 300; // letter in a minute int time = 20; cin >> time; //your code goes here count *= time; cout << count << endl;
5th Dec 2021, 2:09 PM
kleiber Pérez Montero
kleiber Pérez Montero - avatar
0
#include <iostream> using namespace std; int main() { int speed = 300; //speed of the robot int time, result; //declare variables cin >> time; //input the time result = time * speed; cout << result; //output the result return 0; } Good Luck
25th Jan 2022, 11:06 AM
Muhammad Alif Deva Rizqon
Muhammad Alif Deva Rizqon - avatar
0
#include <iostream> using namespace std; int main() { int speed = 300; //speed of the robot int time, result; //declare variables cin >> time; //input the time result = time * speed; cout << result; //output the result return 0; }
23rd Jun 2022, 1:53 PM
Nicolo' Zanotti
Nicolo' Zanotti - avatar