Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int Suma_cif (unsigned long x)
- {
- int S= 0;
- while(x){
- S+=x%10;
- x/=10;}
- return S;}
- int Cif_control (unsigned long x)
- {
- while(x>9)
- x=Suma_cif(x);
- return x;
- }
- int Prim(int x)
- {
- if (x<2)
- return 0;
- for(int i=2; i<= sqrt(x);i++)
- if(x%i == 0)
- return 0;
- return 1;
- }
- int Nr_Cifre_pare(long N)
- {
- int nr=0,uc;
- while(N!=0){
- uc=N%10;
- if(uc%2==0)
- nr++;
- N/=10;
- }
- return nr;
- }
- int Triunghi(float a, float b,float c)
- {
- if((a+b)>c) & ((a+c)>b) & ((b+c)>a)
- return 1;
- else
- return 0;
- int main()
- }
- int Palindrom(int n)
- {
- int inv=0,cn=n;
- while(n!=0)
- inv =inv*10 + n%10;
- n/=10;
- }
- {
- /* int N,p,x;#include <iostream>
- #include <math.h>
- using namespace std;
- int Suma_cif (unsigned long x)
- {
- int S= 0;
- while(x){
- S+=x%10;
- x/=10;}
- return S;}
- int Cif_control (unsigned long x)
- {
- while(x>9)
- x=Suma_cif(x);
- return x;
- }
- int Prim(int x)
- {
- if (x<2)
- return 0;
- for(int i=2; i<= sqrt(x);i++)
- if(x%i == 0)
- return 0;
- return 1;
- }
- int Nr_Cifre_pare(long N)
- {
- int nr=0,uc;
- while(N!=0){
- uc=N%10;
- if(uc%2==0)
- nr++;
- N/=10;
- }
- return nr;
- }
- int main()
- {
- /* int N,p,x;
- cin >>N;
- cout <<endl <<"Cerinta A: ";
- for (int i=2;i<=N;i++)
- if(Prim(i) ==1)
- cout << i << " ";
- cout <<endl <<"Cerinta B: ";
- int gasite=0,i=2;
- while(gasite < N){
- if (Prim(i))
- gasite++;
- i++;
- cout << i << " ";
- }
- int N;
- cin >> N;
- cout << Nr_Cifre_pare(N);
- return 0;
- }
- cin >>N;
- cout <<endl <<"Cerinta A: ";
- for (int i=2;i<=N;i++)
- if(Prim(i) ==1)
- cout << i << " ";
- cout <<endl <<"Cerinta B: ";
- int gasite=0,i=2;
- while(gasite < N){
- if (Prim(i))
- gasite++;
- i++;
- cout << i << " ";
- }
- int N;
- cin >> N;
- cout << Nr_Cifre_pare(N);
- */
- int main
- return 0;
- }
Add Comment
Please, Sign In to add comment