[ create a new paste ] login | about

Link: http://codepad.org/dHUE94Jf    [ raw code | output | fork ]

C++, pasted on Sep 13:
#include <iostream>
using namespace std;

    int n;
    int sum;
    int i;

int main()
{

    
    cout << "Enter a number" << endl << endl; 
    cin >> n;
    
   while(n>10){
       i=n%10;
       i*i;
       sum=sum+i;
       n/10;
       }
    
    cout << i << endl;
    
    return 0;
}


Output:
1
2
3
Enter a number

0


Create a new paste based on this one


Comments: