98.3k views
10 votes
Write code that outputs variable numDays as follows. End with a newline. If input is 3, output is: Days: 3

User Jjlin
by
5.6k points

1 Answer

10 votes

Answer:

In C++:

#include<iostream>

using namespace std;

int main(){

int numDays;

cin>>numDays;

cout<<"Days: "<<numDays<<endl;

return 0;

}

Step-by-step explanation:

This line declares numDays as integer

int numDays;

This line gets user input for numDays

cin>>numDays;

This line prints the required output and ends with a newline

cout<<"Days: "<<numDays<<endl;

User Dima Knivets
by
5.3k points