Computer Science, asked by Ronald11, 1 year ago

Wap to print series till 100 with there SUM

Answers

Answered by anuj
0
heya friend,

we have to run a loop till 100 and print 1-100 in loop and print the sum after the loop


class printsum
{   
     public static void main()
     {
          int sum =0;
        for ( int i=1;i<=100;i++)
          {
               sum=sum+i;
                
                 System.out.println(i);
           }
          System.out.println("SUM IS ="+sum);
      }
 }



Hope the program helps!!!!!!!!!!!
Answered by Pravallika2411
0
if sum = 0;
while( n <= 100;i = n ; i ++) {
sum = sum +i;
}
print("%d",sum);

Ronald11: sorry it my be correct but i needed in java
Ronald11: may*
Pravallika2411: ok
Similar questions