Wednesday, June 29, 2022

Loop debugging 14

 Loop debugging 14

Problem Statement
Given an integer N, your task is to print all the even integer from 1 to N.

public static void For_Loop(int n){
        for(int i=2;i<=n;i++){
            System.out.print(i+" ");
            i+=1;
        }
    }

No comments:

Post a Comment

ads vert

Basic HTML Tables - Layout, HTML Tables, Attributes, Aside, Footer, Tr tag, Td tag, Th tag, Tbody

  Basic HTML Tables - Layout, HTML Tables, Attributes, Aside, Footer, Tr tag, Td tag, Th tag, Tbody < table >      < thead >    ...