Java program to total number of odd numbers between 1 -100



Code

package com.candidjava.code;

class TotalNumOfOddNum
{
	public static void main(String args[])
	{
		int count = 0;
		for(int i = 1;i <= 100;i++)
		{
			if(i % 2 != 0)
			{
				count++;
			}
		}
		System.out.println("The Count Of Odd Numbers are:" + count);
	}
}


Output:

The Count Of Odd Numbers are:50




Related Post

Comments


©candidjava.com