//Program to print prime and composite numbers upto n #include #include int main() { int printPrime(int),printComp(int),n,p,c; printf("Enter a number : "); scanf("%d",&n); printf("Prime numbers upto %d : ",n); p=printPrime(n); printf("\nComposite numbers upto %d : ",n); c=printComp(n); getch(); } //The printPrime function int printPrime(int a) //a is user input { int f,i,temp,d,v; //v is is used to keep track of divisors for(temp=1;temp<=a;temp++) { v=0; //Reset divisor count to 0 for the term for(d=2;d