diff --git a/Armstrong_Number_Or_Not.cpp b/Armstrong_Number_Or_Not.cpp new file mode 100644 index 0000000..b4752d6 --- /dev/null +++ b/Armstrong_Number_Or_Not.cpp @@ -0,0 +1,33 @@ +#include +#include +using namespace std; + +int count = 0, sum = 0, digit; + +int count_digit(int n) +{ + if(n >= 10) + count_digit(n / 10); + int digit = n%10; + count++; + return count; +} + +bool each_digit(int n) +{ + if(n >= 10) + each_digit(n / 10); + int digit = n%10; + sum = sum + pow(digit, count); + if(sum == n) + return true; + return false; +} + +int main() +{ + int n; + cin >> n; + count_digit(n); + each_digit(n) ? cout << "ARMSTRONG" : cout << "NOT AN ARMSTRONG"; +} \ No newline at end of file diff --git a/Armstrong_Number_Or_Not.exe b/Armstrong_Number_Or_Not.exe new file mode 100644 index 0000000..dab736e Binary files /dev/null and b/Armstrong_Number_Or_Not.exe differ diff --git a/Centigrade_to_Fahrenheit.cpp b/Centigrade_to_Fahrenheit.cpp new file mode 100644 index 0000000..1937c8e --- /dev/null +++ b/Centigrade_to_Fahrenheit.cpp @@ -0,0 +1,12 @@ +#include +#include +using namespace std; + +int main() +{ + int cel; + float F; + cin >> cel; + F = ((cel*1.8)+32); + cout << fixed << setprecision(2) << F; +} \ No newline at end of file diff --git a/Centigrade_to_Fahrenheit.exe b/Centigrade_to_Fahrenheit.exe new file mode 100644 index 0000000..265557c Binary files /dev/null and b/Centigrade_to_Fahrenheit.exe differ diff --git a/Perfect_Square.cpp b/Perfect_Square.cpp new file mode 100644 index 0000000..9d9a759 --- /dev/null +++ b/Perfect_Square.cpp @@ -0,0 +1,16 @@ +#include +using namespace std; + +bool perfectSquare(int n){ + for (int i=1; i<=n; i++) + if((i*i) == n) + return true; + return false; +} + +int main() +{ + int n; + cin >> n; + perfectSquare(n) ? cout << "YES" : cout << "NO"; +} \ No newline at end of file diff --git a/Perfect_Square.exe b/Perfect_Square.exe new file mode 100644 index 0000000..bdb1ffa Binary files /dev/null and b/Perfect_Square.exe differ diff --git a/Strong_Number.cpp b/Strong_Number.cpp index 55d3d52..dbde4e9 100644 --- a/Strong_Number.cpp +++ b/Strong_Number.cpp @@ -16,7 +16,6 @@ bool print_each_digit(int x) print_each_digit(x / 10); int digit = x%10; - //cout << digit << endl; sum = sum + fact(digit); if(sum == x) { return true; diff --git a/Sum_Of_Prime_Numbers.cpp b/Sum_Of_Prime_Numbers.cpp new file mode 100644 index 0000000..4310668 --- /dev/null +++ b/Sum_Of_Prime_Numbers.cpp @@ -0,0 +1,27 @@ +#include +using namespace std; + +bool isPrime(int k) { + for (int i=2; i> l; + cin >> u; + if(l!=0){ + for (int k=(l+1); k