Write the output and if there is an error correct the error first then write the output:
1.for(int a=1; a<=3; a++)
for(int b=2; b<5; b++)
out.print(a+b + " ");
2.for(int i=2; i<=6; i++){
for(int j=1; j<=i; j++)
out.print('*');
out.println();
}
3.int total = 0;
for(int c=2; c<7; c++)
for(int d=1; d<=c; d++)
total = total + d;
out.println(total);
4.String s = "apluscs";
for(int e=0; e<s.length(); e++)
{
for(int f=0;f<=e;f++){
System.out.print(s.charAt(f));
}
System.out.println();
}
5.for(int count1=1; count1 <= 5; count1++)
{
for (int count2=1; count2 <= 5; count2++)
System.out.print (count1*count2 + " ");
System.out.println();
}
6.public static void main(String args[]) {
int a,b;
a = 3;
b = 4;
System.out.println(three(a,b));
}
public static int three(int x, int y) {
int a;
a = x + y;
return a;
}
output
output
output
output
output
output
Comments
Leave a comment