Computer Science, asked by aadyasharma150307, 3 months ago

Draw the flowchart to find the sum of odd numbers from 1-100

Answers

Answered by samarthkrv
0

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

 int sum = 0;

     for(int i = 0; i <= 100; i++){

         if(i % 2 == 1){

             sum = sum + i;

         }

     }

     System.out.println("The sum of the first 100 odd numbers is " + sum);

}

}

Explanation:

Similar questions