Computer Science, asked by ishaaggarwal62, 5 months ago

given an integer n find and print the sum of numbers from 1 to n use while loop only

Answers

Answered by nandinikaushik85
5

Answer:

n = input(int("enter the value"))

sum = 1+n*1

for i in sum

     print(sum)

Explanation:

Answered by abhay03ac
0

Answer:

import java.util.Scanner;

class all

{

Scanner sc=new Scanner(System.in);

int sum;

public void main(String args[])

{

 System.out.println("enter the number you want the sum of");

int n=sc.nextInt();

int a=1;

while(a<=n)

{

   sum=sum+a;

   a++;

}

System.out.println(sum);

}

}

Explanation:

Similar questions