About 5,320,000 results
Open links in new tab
  1. Prime Number Program in C - GeeksforGeeks

    2 days ago · A prime number is a natural number greater than 1 and is completely divisible only by 1 and itself. In this article, we will learn how to check whether the given number is a prime number or not in C. Examples: Input: n = 29 Output: 29 is Prime Explanation: 29 has no divisors other than 1 and 29 itself. Hence, it is a prime number. Input: n = 15

  2. C Program to Check Whether a Number is Prime or Not

    In this example, you will learn to check whether an integer entered by the user is a prime number or not with explanation... Learn to code solving problems and writing code with our hands-on C Programming course.

  3. C Program to Check Prime Number: Simple Methods Explained - Simplilearn

    Apr 10, 2025 · C Program for Prime Numbers Within a Range Algorithm to Find Prime Number. STEP 1: Take the range values left and right as input. STEP 2: Initialize a loop iterator num to left. STEP 3: Iterate a “for” loop from left to right. STEP 4: Iterate a “for” loop from 2 to num/2. STEP 5: Initialize a variable temp to 0.

  4. Prime Number Program In C - Online Tutorials Library

    Prime Number Program in C - Learn how to implement a prime number program in C with examples. Understand the logic and code behind finding prime numbers in this programming tutorial.

  5. C Program to Print Prime Numbers From 1 to N - GeeksforGeeks

    Sep 11, 2024 · In this article, we will learn to generate and display all prime numbers from 1 to N in C programming language. Check every number from 1 to N whether it is prime by using isPrime () function. Iterate from 2 to sqrt (N) and check if the number is …

  6. c - Prime Number Algorithm - Stack Overflow

    Can anyone tell me how to implement Sieve of Eratosthenes algorithm in C? I need to generate prime numbers but my algorithm is slow. My code: long int j; int state = 1; for(j=2;j<i;j++) if((i%j)==0){state=0;break;} return state; int t; long int m,n,i; scanf("%d", &t); while(t--) { scanf("%d %d", &m,&n); for(i=m;i<=n;i++) if(i==1){

  7. Prime Number Program in C: A Step-by-Step Guide - NxtWave

    Learn to create a prime number program in C with examples. Explore prime no. code in C using loops, recursion, functions, and sqrt(N) logic to identify primes efficiently.

  8. Prime Number Program In C | 12 Ways & Complexity Analysis …

    We can write a prime number program in C using various methods like the naive approach, sqrt(N), optimized iterations, Wilson's Theorem, recursion, loops, etc.

  9. C Program for Prime Numbers | Check & Print Primes - upGrad

    Mar 21, 2025 · Writing a prime number program in C enhances your understanding of loops, conditions, and efficient algorithms for number processing. In this tutorial, you'll learn how to create this program step-by-step using 7 methods, helping you sharpen your programming skills and deepen your understanding of C.

  10. How to Check Prime Numbers in C: A Complete Guide with Code

    Jan 7, 2025 · Learn how to check prime numbers in C programming with this comprehensive guide. Explore step-by-step explanations, optimized code examples, and tips for efficient algorithms.

  11. Some results have been removed
Refresh