11. Calculate simple interest.
Required Input:
principal = 1000, rate = 5, time = 2
Expected Output:
Simple Interest = 100.00
Code In C
#include
int main() {
float principal = 1000, rate = 5, time = 2;
float interest;
// Logic to calculate simple interest
return 0;
}
Output
Click Run Button to view compiled output
12. Check if a character is a vowel.
Required Input:
ch = 'a'
Expected Output:
Vowel
Code In C
#include
int main() {
char ch = 'a';
// Logic to check for vowel
return 0;
}
Output
Click Run Button to view compiled output
13. Calculate power of a number.
Required Input:
base = 2, exponent = 3
Expected Output:
Power = 8
Code In C
#include
int main() {
int base = 2, exponent = 3;
int result = 1;
// Logic to calculate power
return 0;
}
Output
Click Run Button to view compiled output
14. Find the GCD of two numbers.
Required Input:
a = 8, b = 12
Expected Output:
GCD = 4
Code In C
#include
int main() {
int a = 8, b = 12;
int gcd;
// Logic to find GCD
return 0;
}
Output
Click Run Button to view compiled output
15. Check if a number is prime.
Required Input:
num = 17
Expected Output:
Prime
Code In C
#include
int main() {
int num = 17;
int is_prime = 1;
// Logic to check for prime
return 0;
}
Output
Click Run Button to view compiled output
16. Find the LCM of two numbers.
Required Input:
a = 4, b = 5
Expected Output:
LCM = 20
Code In C
#include
int main() {
int a = 4, b = 5;
int lcm;
// Logic to find LCM
return 0;
}
Output
Click Run Button to view compiled output
17. Check if a number is an Armstrong number.
Required Input:
number = 153
Expected Output:
Armstrong Number
Code In C
#include
int main() {
int number = 153;
int sum = 0, temp, remainder;
// Logic to check Armstrong number
return 0;
}
Output
Click Run Button to view compiled output
18. Reverse a string.
Required Input:
str = "hello"
Expected Output:
olleh
Code In C
#include
#include
int main() {
char str[] = "hello";
char reversed[100];
// Logic to reverse the string
return 0;
}
Output
Click Run Button to view compiled output
19. Find the sum of even numbers up to n.
Required Input:
n = 10
Expected Output:
Sum = 30
Code In C
#include
int main() {
int n = 10;
int sum = 0;
// Logic to calculate sum of even numbers
return 0;
}
Output
Click Run Button to view compiled output
20. Check if a string is a palindrome.
Required Input:
str = "madam"
Expected Output:
Palindrome
Code In C
#include
#include
int main() {
char str[] = "madam";
int is_palindrome = 1;
// Logic to check palindrome
return 0;
}
Output
Click Run Button to view compiled output