Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include<iostream>
  2.  
  3.  
  4. using namespace std;
  5.  
  6. int main (){
  7.  
  8.         int N, X, I, CP, CD, PP, UP, PPP, UPP;
  9.         CP=CD=0;
  10.  
  11.         for (X=1;X<=7;X++){
  12.  
  13.         cout<<"Digite un numero: "; cin>>N;
  14.  
  15.         if (N%2==0){
  16.             CP++;
  17.             if (CP==1){
  18.                 PP=N;
  19.                 PPP=X;}
  20.         }
  21.  
  22.         for (I=1;I<=N;I++){
  23.             if (N%I==0)
  24.             CD++;}
  25.  
  26.         if (CD<=2){
  27.             UP=N;
  28.             UPP=X;}
  29.         }
  30.     cout<<"El primer numero par es: "<< PP << " con la ubicacion numero: " << PPP <<endl;
  31.     cout<<"El ultimo numero primo es: "<< UP << " con la ubicacion numero: " << UPP <<endl;
  32.  
  33.     return 0;
  34.  
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement