Wap to print series till 100 with there SUM
Answers
Answered by
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!!!!!!!!!!!
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
0
if sum = 0;
while( n <= 100;i = n ; i ++) {
sum = sum +i;
}
print("%d",sum);
while( n <= 100;i = n ; i ++) {
sum = sum +i;
}
print("%d",sum);
Ronald11:
sorry it my be correct but i needed in java
Similar questions