Write a program to input a number from the keyboard. Print all numbers from 1 to that number.
Answers
Explanation:
When the conductor accidentally stepped on the writer's toe, he immediately apologized.
The conductor was a very humble person and he was very apologetic to the writer for hurting him.
The writer was impressed with his behavior that he made sure the conductor is satisfied.
The writer said that everyone should be kind enough to apologize to others for hurting others.
import java.util.Scanner; // importing the Scanner class for input.
public class Main { // Class name is declared as "Main".
public static void main(String [] args) { // Main method required in almost every java program
Scanner sc = new Scanner(System.in); // Activation of the Scanner
int usin = sc.nextInt(); // getting the user input in integer
for (int i = 1; i <= usin; i++) { // for loop
System.out.println(i + "\n"); // method for printing
}
}
}
usin = int(input()) # getting the input
for i in range(1, usin + 1): # for loop
print(str(i) + "\n") # method for printing