Computer Science, asked by hussainzia2005, 4 months ago

Write a program in java to display the n terms of odd natural number and their sum .
Test Data
Input number of terms : 10
Expected Output :
The odd numbers are :1 3 5 7 9 11 13 15 17 19
The Sum of odd Natural Number upto 10 terms : 100

pls tell the answer till Wednesday (3/3/2021)​

Answers

Answered by annikanegiranjan
0

Answer:

public class oddnumber

{

public static void main()

{

int i , s=0;

for (i=1; i<=10; i+=2)

sum= s+i;

System.out.println("the sum is"+s);

}//end of main

}end of class

Explanation:

i hope this helped :) pease mark as brainliest!

Similar questions