What do you want to save?
Add Code snippet
New code examples
-
Python 2022-02-02 18:20:43
n natural numbers
Method 1: num = int(input("Enter the Number:")) value = 0 for i in range(1, num+1): value = value + i print("Sum of N natural numbers:", value) Method 2: num = int(input("Enter the Number:")) sum = (num * (num+1))/2 ... Add solution -
Java 2021-09-03 20:49:01
sum in range
//Java program to print the sum of numbers in a given rangeimport java.util.Scanner;public class sum_of_numbers_in_range{ public static void main(String[] args) { //scanner class declaration Scanner sc = new Scanner(System.in); //input from user Syst... Add solution
Best helpers
Ranking is empty