what is the sum of first n positive integers?
Plz answere...
Answers
Answered by
0
Answer:
Sum of first n positive integers is n(n + 1)/2
Step-by-step explanation: Hope you liked the solution. Please mark me as the brainliest.
Answered by
1
Answer:
Write a program in java to calculate the sum of first n positive numbers
Step-by-step explanation:
import java.util.*;
class Sum
{
public static void main (String args[])
{
Scanner obj = new Scanner (System.in);
int n,i,s=0;
System.out.println("Enter the number of first positive numbers");
n=obj.nextInt();
for(i=1;i<=n;i++)
{
s=i+s;
}
System.out.println("Sum of first " +n+ " positive numbers :- " +s);
}
}
Similar questions