This Java program defines a class called "sum" with a main method that takes an integer parameter n. It uses a for loop to iterate from 1 to n, printing each number and adding it to a running total s. After the loop, it prints the final sum.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
59 views1 page
Some Icse Class 9 Programms
This Java program defines a class called "sum" with a main method that takes an integer parameter n. It uses a for loop to iterate from 1 to n, printing each number and adding it to a running total s. After the loop, it prints the final sum.