How to print India by nested loop?
I
IN
IND
INDI
INDIA
Answer Posted / rashi
class Find{
public static void main (String args[])
{
String s="India";
int i,j;
l=s.length();
for(i=0;i<l;i++)
{
for (j=0;j<=i;j++)
{
char ch=S.charAt(i);
System.out.print(ch);
}
System.out.println(" ");
}
}
}
Is This Answer Correct ? | 1 Yes | 2 No |
Post New Answer View All Answers
What is the use of in c?
Why shouldn’t I start variable names with underscores?
Explain what is the general form of a c program?
Why flag is used in c?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
Explain what happens if you free a pointer twice?
What is difference between constant pointer and constant variable?
What are the advantages of using macro in c language?
Explain how can you restore a redirected standard stream?
Is c easier than java?
How reliable are floating-point comparisons?
Write a program to print fibonacci series using recursion?
What's a good way to check for "close enough" floating-point equality?
What happens if a header file is included twice?
Explain how do you generate random numbers in c?