Concept explainers
How many lines will each of the following while loops display?
A) int count = 1 ;
while (count < 5)
{ cout << "My favorite day is Sunday \n";
count = count + 1;
}
B) int count =10;
while (count < 5)
{ cout << "My favorite day is Sunday \n";
count = count + 1;
}
C) int count = 1;
while (count < 5);
{ cout « "My favorite day is Sunday \n";
count = count + 1;
}
D) int count = 1;
while (count < 5)
cout <<"My favorite day is Sunday \n";
count = count + 1;
Learn your wayIncludes step-by-step video
Chapter 5 Solutions
Starting Out with C++: Early Objects (9th Edition)
Additional Engineering Textbook Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
SURVEY OF OPERATING SYSTEMS
Modern Database Management
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Starting Out with Python (4th Edition)
Concepts Of Programming Languages
- The program segment has errors. Find as many as you can. // This code should use a loop to raise a number to a power. int num, bigNum, power, count;cout << "Enter an integer: "; cin >> num; cout << "What power do you want it raised to? "; cin >> power; bigNum = num; while (count++ < power); bigNum *= num; cout << "The result is << bigNum << end1;arrow_forwardJAVA:arrow_forwardProgramming language C#arrow_forward
- 1.Convert the while loop in the following program to for loop. #include int main() { Int num rem,reverse_num3%3; printf("nEnter any number:"); scanf("%d",&num); while(num>=1) { rem=num%10; reverse_num=reverse num*10+rem; num=num/10; printf(nReverse of input number is:%d",reverse_num); return 0:arrow_forwardMPI Lab Directions Write an MPI program, countprimes which will count the number of prime numbers in the numbers from 1 to n inclusive where n is a long integer. The value for n which should be set in the program using a constant should be 50,000. Each process will test its share of the cases. Each process should not print out any primes that it finds, but it should keep a running total. Before the process finishes, it should print out its ID number and its count of primes that it found. The master process should end with printing a total for the count of the number of primes and the total amount of time taken to find all the primes. Take a screenshot of the output for running this with 5 processes. Before submission, make sure you clean up the directories so that no miscellaneous files are kept around in the submission. (Grade would be deducted if useless files are found in the homework directories.) Include the source code, screenshot, and the Makefile in the submission. Your…arrow_forwardLap Timer Tool Write a program ON PYTHON that asks the user to enter the number of times that they have run around a racetrack, and then uses a loop to prompt them to enter the lap time for each of their laps. When the loop finishes, the program should display the time of their fastest lap, the time of their slowest lap, and their average lap time.arrow_forward
- pythonarrow_forwardThe program segment has errors. Find as many as you can. // This code should average a set of numbers. int numCount, total;double average; cout << "How many numbers do you want to average? "; cin >> numCount;for (int count = 0; count < numCount; count++) {int num;cout << "Enter a number: "; cin >> num;total += num; count++;}average = total / numCount;cout << "The average is << average << end1;arrow_forwardNumber Guessing Game. The program will generate a random number from 1 to 1000. The player will be given several chances to guess the number. The program gives a hint that the given number is lower or higher. If the player's guess is correct, give the player a single point. Tally the number of correct and wrong guesses that the player has made. After every round, display the tally (correct, wrong, and score) After a cycle the program will ask the user if he wants to continue playing. This is a console project. Below source code is my answer with the Question. Kindly check it sir/maam if i have the problem with the code. Thank you using System;using System.Collections.Generic;using System.Text;class Program{static void Main(string[] args){while (true){int randno = Newnum(1, 1001);int count = 1;while (true){Console.Write("Enter a number between 1 and 1000(0 to quit):");int input = Convert.ToInt32(Console.ReadLine());if (input == 0)return;else if (input <…arrow_forward
- Untitled Section This is a segment of program, when it executed with multiple values for n and s the program displays the value of f, choose which output of f values are wrong answers cin>>x>>y; if (x>1) &&(y<5) {f=x+y*9; else f-x-y-11; } cout<arrow_forwardRandom Number Guessing Game Write a program that generates a random number between 1 and 100 and asks the user to guess what the number is. If the user’s guess is higher than the random number, the program should display “Too high. Try again.” If the user’s guess is lower than the random number, the program should display “Too low. Try again.” The program should use a loop that repeats until the user correctly guesses the random number. Then the program should display “Congratulations. You figured out my number.”arrow_forwardCOM Random Number Guessing Game Write a program that generates a random number and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display «Too high, try again." If the user's guess is lower than the random number, the program should display "Too low, try again." The program should use a loop that repeats until the user correctly guesses the random number.arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage