*

*
*#include <fstream>
#include <iostream>
using namespace std;
bool flag=false;
void check(int i)
{
int sum=0;
char n[5];
itoa(i,n,10);
for(int j=0;j<5 && n[j] != '\0';j++)
{
char p = n[j];
sum += atoi(&p);
}
if(sum==3 || sum==6 || sum==9)
flag = true;
else if(sum>9)
check(sum);
}

void main()
{
int i;
cout<<"Enter the number : ";
cin>>i;
check(i);
if(flag == true)
cout<<i<<" is divisible by '3'"<<endl;
else
cout<<i<<" is not divisible by '3'"<<endl;
}*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to