Structure program in Qbasic

Observe the following coding in qbasic :--

FOR  I=1 TO 5
FOR J=1 TO 5
IF (I=J) OR (I+J=6) THEN
PRINT "*"; 
ELSE
PRINT "  ";
END IF
NEXT J,I

The output will produce a structure that looks like a letter in the English alphabet! Can you find the letter?

S A J X

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

18 solutions

There is no newline character so, X will not form. X is possible only when there is newline character. Output will be in single line.

We should all get the points back that we lost from trying this...

Joseph Michail - 7 years, 2 months ago

True and I assumed he added a new line character and then gave the answer as X. But flimsy code, real flimsy and careless.

Bala Tweakbytes - 7 years, 2 months ago

I got it soo right !! well this structure we had it last year at the final exams

Chii Maa - 7 years, 2 months ago

True same views are mine

Ayesha Afzal - 7 years, 2 months ago

1

Rana Asif - 7 years, 2 months ago

What

saroar jahan shuvo - 7 years, 2 months ago

Log in to reply

diffrance b/w class and arry

Fahad Ayub - 7 years, 2 months ago

what is schudeling

Fahad Ayub - 7 years, 2 months ago

hmmmm difficult

SuShil YaDav - 7 years, 2 months ago

So easy, you must to a newline @ each iteration w

manche courte - 7 years, 2 months ago

X

Aftab Alam - 7 years, 2 months ago

i think the output will be like this /

Mon Leyson - 7 years, 2 months ago

Yeah, you're right, but there is no "none of the the above" or "no letter would form" choice... But if you would just ASSUME that there is, X is the one.

Adrian Hansen - 7 years, 2 months ago

* * * * * * * * ie exact output,not any char

Shama Dassor - 7 years, 2 months ago

Log in to reply

no blanks showing posting

Shama Dassor - 7 years, 2 months ago

i kind of guessed that the line printf("\n"); was missing lol :)

Ami Rukshar - 7 years, 2 months ago

thats what I was thinking, and drew a straight line for the first time.........

Yashasvini Sharma - 7 years, 1 month ago
Sandeep Thakur
Mar 28, 2014

Could solve it just by watching the pattern...

if i==j then print "*", that means a * at exact center,

and (i+j)=6 means if i=4, j=2 then *... j=4 and i=2... then *... So its kind of symmetrical for me... so X was obvious...

Debajyoti Ghosh
Apr 15, 2014

No new line char is there....So X will not printed...if there is any new line char after j-th loop then X Char printed.......

lol i just guessed it!

Nick Nicolas
Apr 24, 2014

Definitely at the end of the program when it reached six tries it will give an output of an asterisk where letter X is the most proximate figure when it comes to the letters in the alphabet.

Ram Krishna
Apr 22, 2014

If we assume that there is a new line character (Which is not there in the question!!) the solution may lead to X...

Sasui Wagan
Apr 3, 2014

i think its print blank space

Daniel Lim
Apr 2, 2014

I thought there should be a newline?

Suresh Munuswamy
Mar 30, 2014

new line has to assumed then X will be printed

where is the new line character??????

Sayam Chakravarty - 7 years, 2 months ago
Amogh Jain
Mar 30, 2014

The answer is X but the code is not proper since we have to assume a new line character.

Trần Hiển
Mar 29, 2014

"Run" it on paper and receive letter 'X' :)

just simply use paper run them and get the answer

Shubham Gupta - 7 years, 2 months ago

hy

Abid Ali - 7 years, 2 months ago
Anirban Acharya
Mar 28, 2014

considering that there is new line character the only pattern that can form is X else the answer will be none of the given options if we consider new line character

agreed

Rizwan Mahfooz - 7 years, 2 months ago
Sachin Godse
Mar 28, 2014

Answer will be the X

X

Khasin Mochammad - 7 years, 2 months ago

That's right.

star starshine - 7 years, 2 months ago
Islam Zakaria
Mar 28, 2014

The Solution will be X

yes x is the answer

urooj malik - 7 years, 2 months ago

the output should be the x

jelyn comandante - 7 years, 2 months ago
Sanjay Kamath
Mar 28, 2014

simple dry run can help solve the problem

Hamza Bellal
Mar 28, 2014

There's no return to line after the second loop is done. So the output won't be an X, the output will be on one line.

the output will be x in the form of * because the looping condition are in such a way thats why

Adarsh Sodagudi - 7 years, 2 months ago
Ebin Antoney T
Mar 28, 2014

The output will look like 000 0 0 0 00 00 0 0 0 *000

Dharmesh Gupta
Mar 28, 2014

Will Print X. The first loop prints 5 rows and the 2nd will print the stars when the conditions mentioned are satisfied So "*" would be printed when... X,Y(1,1), X,Y(1,5) X,Y(2,2) X,Y(2,4) and so on...

THIS could be Right I Think

Daniel Morla - 7 years, 2 months ago

Log in to reply

Yes X is correct ans...

Kalyan Chandela - 7 years, 2 months ago

the output could be X.

Madhu Bala - 7 years, 2 months ago

yes it should be X as i+j=6 & i=j

Kuntal Ghosh - 7 years, 2 months ago

No, answer will not be X. there is no newline character then how control will go to new line. that's why output will be in single line. and X will not form

Bhushan Dhurandhar - 7 years, 2 months ago

X is the answer

Karthik Sekaran - 7 years, 2 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...