import java.util.*;
public class oddSum
{
public static void main(String args[])
{
Scanner p= new Scanner(System.in);
System.out.println("Enter the limit of odd addition numbers :");
int sum=0,limit=p.nextInt();
for(int i=0;i<=limit ;i++)
{
if(i%2==1)
sum+=i;
}
System.out.println("The sum of odd numbers is ="+sum);
}}
0 comments:
Post a Comment