Coding
#include<iostream>//header file for input and output
here
using namespace std;
int main()//main start
{
int g;//Declare variable
g=0;//initilize value as zero
/*
while (if condition is true then and then execute this block
under)
{
//do complicated stuff
}
*/
while(g<=3)//here start condition is true because g value
which is 0 is less then 3 and execute code for 4 times because we
increment it by 1 as value of g is 4 condition will false and get
back to the loop
{
cout<<g;//print output display
g=g+1;//incremented
}
return 0;
}
Codesnap:
output:
if you still have any Problem regarding this question please comment and if you like my code please appreciate me by thumbs up thank you.........
CHALLENGE ACTIVITY CCAIE2.1: Enter the output of the while loop Start Type the program's output #include...
please solve CHALLENGE ACTIVITY 5.3.3: While loop: Insect growth. Given positive integer numinsects, write a while loop that prints that number doubled without reaching 200. Follow each number with a space. After the loop, print a newline. Ex: If numInsects = 16, print: 16 32 64 128 1 #include <iostream> 2 using namespace std; von WN int main() { int numInsects; cin >> numInsects; // Must be >= 1 /* Your solution goes here */ 11 return 0; 12 }...
4) What is the output if the input istom - Sawyer? #include <iostream> using namespace std; int main() { string playerName; cout << "Enter name"; cin >> playerName; cout << endl « playerName; return 0; } a. Tom - Sawyer b. Tom Sawyer c. Tom d. Sawyer 5) Which XXX generates "Adam is 30 years old." as the output? #include <iostream> using namespace std; int main() { string name = "Adam"; int age = 30; XXX return 0; } a....
Extra Credit: What is the output of the following program? (5 points) #include <iostream> using namespace std; int main ( char greetingl6]- ('H', 'e', T, T, 'o', 0'); cout <<"Greeting message: " cout< greeting << endl return 0;
1 #include<iostream> 2 using namespace std; int main() int number; 7 cout < "Enter a number to p cin number; cout << "start:" rint the square numbers in reverse order from numb 10 ut << 1. N was: number return e; 12 13
C++ Program Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less than 100. End each prompt with a newline. Ex: For the user input 123, 395, 25, the expected output is: Enter a number (<100): Enter a number (<100): Enter a number (<100): Your number < 100 is: 25 #include <iostream> using namespace std; int main() { int userInput; /* Your solution goes here */...
2. What is the value of x alter the following code is executed # include<iostream> using namespace std; int main int t-0, c- 0,x-3; while (c < 4) t=t+x; cout << x return 0; a) 3 b) 21 c) 24 d) 48 3. What is the output of the following code? # include<iostream> using namespace std; int main0 int a- 3; for (int i 5; i >0; i) a a+i cout << a << “ “ return 0; d) 8...
Question 28 What is the output of the following program? Assume code is correct. #include <iostream> using namespace std; int main() { int i = 1,j,x = 5, y = 4; while (i <= y) { for (j = 0; j <= y2; j++) cout << 'Z'; cout << endl; i=i+1; } return 0; 3 B IV AA-I E333 X X, B, GT 12pt Paragraph
CHALLENGE ACTIVITY 7.16.1: Enter the output of the ArrayList ADT functions. Jump to level 1 Type the program's output import java.util.ArrayList; import java.util.Scanner; public class IntegerManager ( public static void printSize(ArrayList<Integer> numsList) System.out.println(numsList.size() + "items"); public static void main(String[] args) Scanner scnr = new Scanner(System.in); int currval; ArrayList<Integer> intList = new ArrayList<Integer>(); Input 123-1 printSize (intList); Output currval = scnr.nextInt(); while (currval >= 0) { intList.add(currval); currval = scnr.nextInt(); printSize (intList); intList.clear(); printSize (intList); 1 2 Check Next
* The output of the following code is #include <iostream> using namespace std: int prod (int x, int y=3){ int d; int a=x*y; return (a); int main ({ cout << prod (7) <<" "<<prod (6, 4); return 0; 21 12 O 49 24 O 21 24 O 21 18
CHALLENGE ACTIVITY 13.1.2: Basic function call. Complete the function definition to output the hours given minutes. Output for sample program: 3.5 1 test passed All tests passed 1 #include <iostream> 2 using namespace std; 3 4 void OutputMinutesAsHours (double origMinutes) { 5 6 /* Your solution goes here */ 7 8} 9 10 int main() { 11 double minutes; 12 13 cin >> minutes; 14 15 OutputMinutesAsHours (minutes); // Will be run with 210.0, 3600.0, and 0.0. 16 cout <<...