Advertisement
rahat62

Perfect Numbers

Sep 8th, 2019
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int t,n;
  6.     char ch;
  7.     cin>>t;
  8.  
  9.     cin>>n;
  10.  
  11.     if(n==2 ||n==3 ||n==5 ||n==7 ||n==13 ||n==17 ||n==19)
  12.     {
  13.         cout<<"Yes"<<endl;
  14.  
  15.     }
  16.     else
  17.         cout<<"No"<<endl;
  18.  
  19.  
  20.     for(int i =1 ; i<t; i++)
  21.     {
  22.         cin>>ch>>n;
  23.  
  24.  
  25.  
  26.         if(n==2 ||n==3 ||n==5 ||n==7 ||n==13 ||n==17 ||n==19)
  27.         {
  28.             cout<<"Yes"<<endl;
  29.  
  30.         }
  31.         else
  32.             cout<<"No"<<endl;
  33.     }
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement