- 3
Here is a quiz. The program needs for output the numbers 1 to 9, each on a separate line, followed by a dot: You can use the \n
Quiz
14 Antworten
+ 4
For some more clarity.. Raymond Kazungu
Replace "" by "
Remove space after digit
And add dot after digit.
+ 2
A little typo in your post:
The word "homework" is written h-o-m-e-w-o-r-k
you wrote it q-u-i-z
+ 1
"Don't post your homework
If you post your homework with the aim of having others to do it for you, you'll end up with a pile of Down votes. It's okay to ask for hints, but not for entire solutions. Those questions are for you to work out, so you can learn from the experience." - Sololearn
With that said: Please provide the programming language and your attempt.
+ 1
I attempted this way; print(""1 \n2 \n3 \n4,
\n5 \n6 \n7
\n8 \n9"") , but I am getting syntax error.
+ 1
Raymond Kazungu it is not a serious error.
Watch your "" ! Replace it by ".
+ 1
You have an extra ( " ) and you didn't include the ( . ) after each number
Also you have a stranded ( , ) remove that as well.
Try this all on same line.
print("1. \n2. \n3. \n4. \n5. \n6. \n7. \n8. \n9.")
0
Hi, this is the Q&A section, here you can ask programming related questions and get help with code. What is your question? What have you tried so far?
0
My question is; I am required to make a program that needs to output the numbers 1 to 9, each on a separate line, followed by a dot: such that
1.
2.
3.
So how do I go about it?
0
What is your attempt?
Lesson explains print() function is it used to display output in a line..
You can add by using '\n' in between strings.. So "what had you tried so far..?"
0
I did c++ and l got it . You can used same approach to do it. And this is my code.
Int a =10;
for (int b = 1; b<a; b++) {
cout << b << ".\n" << endl;
}
0
Meaning you have to use ".\n"
0
I did that in C++ and it worked that was why l expressed my idea on that.
0
You must carefully view the codes l provided. You see (.) Infront of ".\n"
0
Raymond Kazungu Did you complete your assignment?