hopingsteam

Untitled

May 6th, 2020
760
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int AP[10];
  2. void suma(unsigned int n, unsigned int &s)
  3. {
  4.     s = 0;
  5.     int c;
  6.     while(n != 0)
  7.     {
  8.         c = n % 10;
  9.         n = n / 10;
  10.         if(c % 2 == 1)
  11.             AP[c] = 1;
  12.     }
  13.     for(int i = 1; i <= 9; i = i + 2)
  14.         if(AP[i] == 1)
  15.             s = s + i;
  16. }
RAW Paste Data