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



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

Hiba
         Submit Query button display Result with Total, average and pass or fail note.(Note:67 and above is pass). and the avarage between 0 to 100

©candidjava.com