Computer Science, asked by sowmya2186, 3 months ago

write a program to display the the given pattern 11111 3333 555 77 9​


atrs7391: Programming language?
BrainlyProgrammer: Please provide the coding Language...Java,Python or Qbasic??

Answers

Answered by BrainlyProgrammer
10

Correct Question:-

  • Program to display the following pattern:-

11111

3333

555

77

9

  • Co de language:- Not mentioned

This is a very easy Question!! here is your answer...done in QBASIC, JAVA, Python.

Qbasic Program :-

CLS

FOR I=1 TO 9 STEP 2

FOR J=9 TO I STEP -2

PRINT J

NEXT J

PRINT

NEXT I

END

Java Program :-

package Co der;

import java.util.*;

public class pattOdd

{

public static void main (String ar [])

{

for(int I=1 ; I<=9; I+=2)

{

for(int j=9 ; j>=I; j-=2)

{

System.out.print(I);

}

System.out.println();

}

}

}

Java Output Attached

Attachments:

anindyaadhikari13: You have written 6 ones(1) in the first line. Correct it.
BrainlyProgrammer: The question is wrong... It should be six 1(one)
anindyaadhikari13: Then your program (Java) is wrong
BrainlyProgrammer: I hv checked the answer in ide....it's correct output
anindyaadhikari13: Check it again, it will print 5 ones and not 6 ones.
BrainlyProgrammer: Oh yeah....I'll correct it later
anindyaadhikari13: Ok. Now, its correct ✔. Good answer.
MasterDhruva: Hello bro, you had written as 'output attached' but there is no photo attached.
BrainlyProgrammer: Oh forgotten..XD
Similar questions