k.jahangir kumar
javaprograms
1 Answer(s)      3 years and 8 months ago
Posted in : Java Beginners

write a program s=12+22+32+.........+352

Advertisement
View Answers

September 9, 2011 at 4:16 PM


class NumberExample 
{
    public static void main(String[] args) 
    {
        int sum=0;
        int m=0;
        for(int i=12; i<=352; i+=10){
        System.out.print(i+" ");
        sum+=i;
        }
        System.out.println();
        System.out.println("Sum of series: "+sum);
    }
}