+ 2
Guys, help me with a Java Program!!?
Write a program to print the series-- 1+2+3+4=10 5+6+7+8=26 9+10+11+12=42 13+14+15+16=58 17+18+19+20=74
6 Answers
+ 14
This is not a challenge, but i have nothing to do: https://code.sololearn.com/W7SDbMc5iPPF/?ref=app
+ 5
class series{
public static void main(String[ ]args){
int sum=0,i;
for(i=1;i<5;i++)
{
sum=sum+i;
}
System.out.println(sum);
sum=0;
for(i=5;i<9;i++)
{
sum=sum+i;
}
System.out.println(sum);
sum=0;
for(i=9;i<13;i++)
{
sum=sum+i;
}
System.out.println(sum);
sum=0;
for(i=13;i<17;i++)
{
sum=sum+i;
}
System.out.println(sum);
sum=0;
for(i=17;i<21;i++)
{
sum=sum+i;
}
System.out.println(sum);
}
}
+ 4
ur vlcm
+ 1
great..kind of solution I was looking for. very easy with lesser variables. thnks.
0
thanks again Gordie...:) Got it