C++ Code
C++ Code
C++
// C++ program to check
// for even or odd
#include <iostream>
using namespace std;
// Returns true if n is
// even, else odd
bool isEven(int n) { return (n % 2 == 0); }
// Driver code
int main()
{
int n = 247;
if (isEven(n) == true) {
cout << "Even" << endl;
}
else {
cout << "Odd";
}
return 0;
}
Output
Odd
int main()
{
string str = "GeeksforGeeks";
return 0;
}
Output
Toggled string: gEEKSFORgEEKS
#include <cstring>
#include <iostream>
Int main()
Int vowels = 0;
Vowels++;
<< endl;
Return 0;
Output
int main()
{
int j = 0;
str[j] = '\0';
j++;
}
cout << "String without vowels: " << str << endl;
return 0;
}
Output
String without vowels: GksfrGks
int main()
{
int n = 7;
cout << findSum(n);
return 0;
}
Output
28
Write a Program to Remove All Characters From a String Except
Alphabets
C++
// C++ Programto remove all characters from a string except
// alphabets
#include <cctype>
#include <iostream>
#include <string>
int main()
{
string str = "Gee$ksfor$geeks";
return 0;
}
Output
Alphabets only: Geeksforgeeks
Write a Program to Find the Factorial of a Number Using Loops
C++
// C++ program to find factorial using loops
#include <bits/stdc++.h>
using namespace std;
return fact;
}
// driver code
int main()
{
int num = 5;
return 0;
}
Output
120