import java.util.Scanner; public class Exam_preparation { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int sum = 0; for(int i=1; i<=10; i++) { System.out.println("enter a number "); sum = sum + scanner.nextInt(); //sum = sum + i; } System.out.println("the sum of number is " + sum); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter