1. #include <stdio.
h>
int main()
{
int a;
printf("enter the value of a ");
scanf("%d",&a);
if(a>10){
printf("number is greater than 10");
}
return 0;
}
2. #include <stdio.h>
int main()
{
int a;
printf("enter the value of a ");
scanf("%d",&a);
if(a>10){
printf("number is greater than 50");
}
return 0;
}
3. #include <stdio.h>
int main()
{
int a;
printf("enter the value of a ");
scanf("%d",&a);
if(a>10){
printf("number is greater than 87");
}
return 0;
}
4. int main()
{
int a;
printf("enter the value of a ");
scanf("%d",&a);
if(a==1){
printf("one");
}
else{
printf("your input is not valid ");
}
return 0;
}
6.#include <stdio.h>
int main()
{
char a;
printf("enter the character");
scanf("%c",&a);
if(a=='a'){
printf("apple");
}
else{
printf("your input is not valid ");
}
return 0;
}
7.#include <stdio.h>
int main()
{
char a;
printf("enter the character");
scanf("%c",&a);
if(d=='d'){
printf("drum");
}
else{
printf("your input is not valid ");
}
return 0;
}
8.#include <stdio.h>
int main()
{
int num;
printf("enter the value of num");
scanf("%d",&num);
if(num%2==0){
printf("even");
}
else{
printf("odd");
}
return 0;
}
9. #include <stdio.h>
int main() {
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num % 5 == 0) {
printf("%d is divisible by 5.\n", num);
} else {
printf("%d is not divisible by 5.\n", num);
}
return 0;
}
10. #include <stdio.h>
int main() {
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num % 10 == 0) {
printf("%d is divisible by 10.\n", num);
} else {
printf("%d is not divisible by 10.\n", num);
}
return 0;
}
11. #include <stdio.h>
int main() {
int num1, num2, sum;
printf("Enter the first number: ");
scanf("%d", &num1);
printf("Enter the second number: ");
scanf("%d", &num2);
sum = num1 + num2;
printf("The sum of %d and %d is %d.\n", num1, num2, sum);
return 0;
}
12. #include <stdio.h>
int main() {
int num1, num2, sub;
printf("Enter the first number: ");
scanf("%d", &num1);
printf("Enter the second number: ");
scanf("%d", &num2);
sub = num1- num2;
printf("The sub of %d and %d is %d.\n", num1, num2, sub);
return 0;
}
13.
#include <stdio.h>
int main() {
int num1, num2, sub;
printf("Enter the first number: ");
scanf("%d", &num1);
printf("Enter the second number: ");
scanf("%d", &num2);
sub = num1- num2;
printf("The sub of %d and %d is %d.\n", num1, num2, sub);
return 0;
}
14. #include <stdio.h>
int main() {
int num1, num2, product;
printf("Enter the first number: ");
scanf("%d", &num1);
printf("Enter the second number: ");
scanf("%d", &num2);
product = num1 * num2;
printf("Result of multiplication: %d\n", product);
return 0;
}
15. #include <stdio.h>
int main() {
int num1, num2, remainder;
printf("Enter the first number: ");
scanf("%d", &num1);
printf("Enter the second number: ");
scanf("%d", &num2);
remainder = num1 % num2;
printf("Result of modulo operation: %d\n", remainder);
return 0;
}
16. #include <stdio.h>
int main() {
int num1, num2, ;
printf("Enter the first number: ");
scanf("%d", &num1);
printf("Enter the second number: ");
scanf("%d", &num2);
remainder = num1 % num2;
printf("Result of modulo operation: %d\n", remainder);
return 0;
}
17. #include<stdio.h>
int main()
{
int num1,num2,div;
printf("Enter First Number : ");
scanf("%d", &num1);
printf("\nEnter Second Number : ");
scanf("%d",&num2);
div=num1/num2;
printf("\nDivision of %d & %d is = %d",num1,num2,div);
return 0;
}
#include <stdio.h>
int main() {
int age;
printf("Enter your age: ");
scanf("%d", &age);
if (age >= 18) {
printf("You are eligible to vote!\n");
} else {
printf("You are not eligible to vote yet.\n");
}
return 0;
}
18. #include <stdio.h>
#include <ctype.h>
int main() {
char character;
printf("Enter a character: ");
scanf(" %c", &character);
if (character == 'Q' || character == 'W' || character == 'E' ||
character == 'R' || character == 'T' || character == 'Y' ||
character == 'U' || character == 'I' || character == 'O' ||
character == 'P') {
printf("The character '%c' belongs to the upper line of the QWERTY
keyboard.\n", character);
} else {
printf("The character '%c' does not belong to the upper line of the QWERTY
keyboard.\n", character);
}
return 0;
}
19.#include <stdio.h>
#include <ctype.h>
int main() {
char character;
// Prompt the user to input a character
printf("Enter a character: ");
scanf(" %c", &character);
// Check if the character belongs to the middle line
if (character == 'a' || character == 's' || character == 'd' ||
character == 'f' || character == 'g' || character == 'h' ||
character == 'j' || character == 'k' || character == 'l') {
printf("The character '%c' belongs to the middle line of the QWERTY
keyboard.\n", character);
} else {
printf("The character '%c' does not belong to the middle line of the QWERTY
keyboard.\n", character);
}
return 0;
}