1 solutions

  • 0
    @ 2025-3-3 16:28:35

    C :

    #include<stdio.h>
    
    void main(){
    	int n;
    	int i;
    	scanf("%d",&n);
    	i=1;
    	while(i<=n){
    		printf("%d\n",i);
    		i++;
    	}
    } 
    
    
    

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
    	int i,n;
    	cin>>n;
    	i = 1;
    	while(i <= n){
    		cout<<i<<endl;
    		i = i + 1;
    	}
    }
    
    

    Java :

    import java.util.Scanner;
    
    public class Main {
    
    	public static void main(String[] args) {
    		Scanner sc = new Scanner(System.in);
    		int n = sc.nextInt();
    		for(int i=1;i<=n;i++) {
    			System.out.println(i);
    		}
    
    	}
    
    }
    

    Python :

    n=int(input())
    i=1
    while i<=n:
         print(i)
         i=i+1
    
    
    • 1

    Information

    ID
    10224
    Time
    1000ms
    Memory
    64MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By