Niloy007

Pranto's Problem 5

Mar 23rd, 2021
566
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5.     int reverse = 0, n;
  6.     printf("Enter a nuber:\n");
  7.     scanf("%d", &n);
  8.     int num = n;
  9.  
  10.     while (n > 0) {
  11.         reverse = (reverse * 10) + (n % 10);
  12.         n /= 10;
  13.     }
  14.    
  15.     for (int i = 2; i < reverse; i++) {
  16.         if (reverse % i == 0) {
  17.             printf("%d is not a prime number.\n", reverse);
  18.             return 0;
  19.         }
  20.     }
  21.     printf("%d is a prime number.\n", reverse);
  22. }
RAW Paste Data