Showing posts with label Determine. Show all posts
Showing posts with label Determine. Show all posts

C program acquires keyboard 10 numbers for each of these numbers to determine if it is a first issue, by printing immediately message should at the end, if none of the numbers you entered was a first issue, print an appropriate message.

Write a C program acquires keyboard 10 numbers for each of these numbers to determine if it is a first issue, by printing immediately message should at the end, if none of the numbers you entered was a first issue, print an appropriate message.

Solution For C Program:

C Program to Detection of a Prime Number

How to write a C Program to Detection of a Prime Number in C Programming Language ?

Write a program to determine whether a number is prime or not. 

Note :A prime number is one, which is divisible only by 1 or itself. 

  1. #include<stdio.h>
  2. main()
  3. {
  4. int num, i;
  5.  
  6. printf ("Enter a number:");
  7. scanf ("%d", &num);
  8.  
  9. i=2;
  10. while (i<=num - 1)
  11.  
  12. {
  13. if (num % i ==0)
  14.  
  15. {
  16. printf ("Not a prime number");
  17. break;
  18. }
  19.  
  20. i++;
  21. }
  22.  
  23. if (== num)
  24.  
  25. printf ("Prime Number");
  26. }