Using Namespace Int Char Int Int
Using Namespace Int Char Int Int
PAlimdrome program
#include <iostream>
using namespace std;
int main(){
char string1[20];
int i, length;
int flag = 0;
length = strlen(string1);
if (flag) {
cout << string1 << " is not a palindrome" << endl;
}
else {
cout << string1 << " is a palindrome" << endl;
}
system("pause");
return 0;
}
?* Perfect number
#include <iostream>
#include <cctype>
using namespace std;
int main(){
int n,i=1,sum=0;
cout << "Enter a number: ";
cin >> n;
while(i<n){
if(n%i==0)
sum=sum+i;
i++;
}
if(sum==n)
cout << i << " is a perfect number\n";
else
cout << i << " is not a perfect number\n";
system("pause");
return 0;
}