int i=1,j=0,n=0;
while(i<4)
{
for(j=1;j<=i;j++)
{
n+=1;
}
i=i+1;
}
System.out.println(n);
}



int i=1,j=0,n=0; while(i<4) { for(j=1;j<=i;j++) { n+=1; } i=i+1; } System.out.println..

Answer / Neelima Sagar

This program calculates the sum of numbers from 1 to 4 and prints it out. The output will be 10.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Teaching Interview Questions

write a simple program that reads a string (e.g. I am a superman) and print it in the reverse order. The output should be printable on the monitor.

0 Answers  


How would you handle an attendance problem in your classroom?

1 Answers  


I want to submit all my new ideasandinventions, how and where? my E-mail add-alkajani@rediffmsil.com mahesh_jani49144@yahoo.com thewholeuniverse@yahoo.com maheshjan@gmail.com web search"maheshjani" in www.google.com,specially groups on the upperside of it. Maheshjani

1 Answers  


How to edit SAM file? any one can help me?

1 Answers  


What are the benefits of extracurricular activities?

1 Answers  


Name the two celebraties associated with "Narmada bachao andolan"

1 Answers  


a non english speaking parent comes to the counter and appears upset. how would you assist them

0 Answers   Cabramatta High School,


What is your basic attitude to work ?

1 Answers  


During which ruler's time, Fa-Hien, a Chinese Buddhist and famous traveller visited India?

1 Answers   RRC Railway Recruitment Cell,


Describe yourself with three adjectives and explain why they were chosen.

1 Answers  


Define visual acuity.

1 Answers   Mahatma Gandhi University,


What is plus curriculum?

1 Answers   Mahatma Gandhi University,


Categories