Computer Science, asked by rajkumarrmedhi, 1 day ago

Write a program to print " the thought of the day" entered by the user 10 times​

Answers

Answered by Akshima123
3

Answer:

hope u asked in java. i have attached the output as well.

Explanation:

import java.util.Scanner;

public class assignment

{

   public static void main()

   {

       Scanner r = new Scanner(System.in);

       System.out.println("Thought for the day");

       String x = r.nextLine();

       int i = 1;

       for(i=1;i<=10;i++)

       System.out.println(x);

   }

Attachments:
Answered by Anonymous
2

A Python Program

The following program has been written using language - Python.

In this program, we'll print out "the thought of the day" on screen for 10 times.

So, basically, to do this, we need to use a for loop with the keyword range in the statement.

Using this method, we can easily print out the "the thought of the day" for 10 times by specifying that 10 number in the \tt{range()} function.

Below we print out the "the thought of the day" on screen for 10 times.

\begin{array}{l}\texttt{for i in range(10):} \\ \qquad\texttt{print("the thought of the day")}\end{array}

Since i starts with 0, the entered text will print out 10 times. i goes from 0 to 3 to 4 to ... to 9. i begins at an index of 0, it works perfectly.

The program above gives the following output shown below.

the thought of the day

the thought of the day

the thought of the day

the thought of the day

the thought of the day

the thought of the day

the thought of the day

the thought of the day

the thought of the day

the thought of the day

Similar questions