Social Sciences, asked by TeeshaAhuja, 11 months ago

Write a program to repeat the string ‘‘GOOD MORNING”

n times. Here n is an integer entered by the user​

Answers

Answered by alokkumar3324
2

n = int(input('Enter value: ')) # user input

for i in range(n):

print('GOODMORNING')

mark my answer brainliest

Answered by archanajhaasl
1

Answer:

str="GOOD MORNING"

n=int(intput ("Enter the value of n:\n"))

if n>0:

printf(str*n)

else:

printf("Invalid value for n,enter only positive values")

Explanation:

  • A string is repeated if its value is greater than zero. Else it will return a blank.
  • We will use the 'If' statement to check the value of 'n' first and then the print statement will be executed.

PROGRAM:

str="GOOD MORNING"

n=int(intput ("Enter the value of n:\n"))

if n>0:

printf(str*n)

else:

printf("Invalid value for n,enter only positive values")

OUTPUT:

Enter the value of n: 5

GOOD MORNING

GOOD MORNING

GOOD MORNING

GOOD MORNING

GOOD MORNING

Similar questions