I have write a program to read 6 numbers and find the average of all odd numbers. here is my code
Scanner get = new Scanner (System.in);
double average = 0, counter = 0 ;
int i, num = 0, sum = 0, count = 0, total = 0;
for(i=0; i<=5; i++)
{
if(i % 2 == 1)
{
count++;
sum += num;
}
}
System.out.println("the sum of odd numbers is "+ total);
System.out.println("the average is " + average);
I tried different approach and still not getting it to work, this is my last approach for now. can u tell me where i am going wrong here.