I have been trying to fix this since two eeks and I have no clue what I am doing wrong. I have gotten the program to work so that it can tell if a number is prime or not, but the problem I am having is showing at the end how many prime numbers there are for the two numbers, calculating the average and lastly asking the user again to input numbers. Can anyone help please!
Here is the my code
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
int x;
int y;
int i;
int c;
int primecount;
int average = average + ;
printf( "Enter two positive integers --> " );
scanf("%d%d" , &x, &y );
while (y >= x )
{
c=0;
printf ( "\n %d:\t" , x );
for(i=2;i<x;i++)
if(x%i==0)
{
printf(" %d ",i);
c++;
}
if (c==0)
printf("Prime");
x++;
primecount++
printf( "\nThere are %d Prime numbers.\n", primecount );
printf( "The average of the prime numbers is %.2f\n", average );
printf( "Enter two positive integers --> " );
scanf("%d%d" , &x, &y );
}
return 0;
}