C program to print all prime numbers from 1 to N.
This program will read the value of N and print all prime numbers from 1 to N. The logic behind implement this program - Run loop from 1 to N and check each value in another loop, if the value is divisible by any number between 2 to num-1 (or less than equal to num/2) - Here num is the value to check it is prime of not.
Print all PRIME numbers from 1 to N using C program
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer