Computer Science, asked by adityan93, 16 days ago

write a program to calculate and print the sum of even integer and Odd integer of the first 20 natural numbers in JAVA ​

Answers

Answered by ashokfarsanmart
0

Answer:

Example 2: Program to Calculate the sum of odd Number using while loop

import java. util. Scanner;

public class demo {

public static void main(String[] args) {

Scanner sc= new Scanner(System. in);

System. out. print("Number of terms is : ");

int num = sc. nextInt();

int sum = 0;

int i=1;

Similar questions