C Program to Print Prime Numbers From 1 to n
1. C program to print numbers from 1 to n using for loop
In this program, the compiler will ask the user to enter the number to which the user wants to print prime numbers using for loop.
Output:

2. C program to Print Prime Numbers from 1 to n using while loop
In this program, the compiler will ask user to enter the minimum and maximum number from which user wants to print all prime numbers between minimum and maximum using while loop.
Output:

In the above program, we have used while loop instead of for loop. Don’t be afraid program is simple and the logic behind the program is the same.
3. C program to print Prime Numbers between 1 to 100 using for loop
Output:

4. C program to print Prime Numbers between 1 to 100 using While loop
Output:

5. Program to calculate the sum of prime number from 1 to 100
In this program, the compiler will calculate and print the addition of prime numbers from 1 to 100
Output:

6. Program to calculate the sum of prime number from 1 to n
Output:

Post a Comment