0% found this document useful (0 votes)
4 views2 pages

Programs Class 10th

The document contains six C programs for a Class 10 curriculum. These programs include checking if a number is positive or negative, finding the greater of two numbers, determining if a number is even or odd, checking pass or fail based on marks, verifying if a character is a digit, and comparing two numbers for equality. Each program is accompanied by code snippets and basic input/output instructions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Programs Class 10th

The document contains six C programs for a Class 10 curriculum. These programs include checking if a number is positive or negative, finding the greater of two numbers, determining if a number is even or odd, checking pass or fail based on marks, verifying if a character is a digit, and comparing two numbers for equality. Each program is accompanied by code snippets and basic input/output instructions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CLASS 10TH PROGRAMS

Program 1: Check Whether a Number is Positive or Negative


#include <stdio.h>
int main()
{
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num > = 0)
printf("The number is Positive");
else
printf("The number is Negative");
return 0;
}

Program 2: Find the Greater Number Between Two Numbers

#include <stdio.h>
int main() {
int a, b;
printf("Enter two numbers: ");
scanf("%d %d", &a, &b);
if (a > b)
printf("%d is greater", a);
else
printf("%d is greater", b);
return 0;
}

Program 3: Check Whether a Number is Even or Odd


#include <stdio.h>
int main()
{
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num % 2 == 0)
printf("The number is Even");
else
printf("The number is Odd");
return 0;
}

[GHSS BHOWANA] Page 1 of 2


CLASS 10TH PROGRAMS
Program 4: Check Pass or Fail (Marks > 50 = Pass)
#include <stdio.h>
int main() {
int marks;
printf("Enter marks: ");
scanf("%d", &marks);

if (marks > = 50)


printf("Pass");
else
printf("Fail");

return 0;
}

Program 5: Check Whether a Number is Digit or Not (Using if-else)

#include <stdio.h>
int main() {
char ch;
printf("Enter a Character: ");
scanf("%c", &ch);

if (ch > = 0 && ch < = 9)


printf("It is a Digit");
else
printf("It is Not a Digit");
return 0;
}

Program 6: Check Whether Two Numbers are Same or Different

#include <stdio.h>
int main()
{
int num1, num2;
printf("Enter first number: ");
scanf("%d", &num1);
printf("Enter Second number: ");
scanf("%d", &num2);
if (num1 = = num2)
printf("Both numbers are Same");
else
printf("Both numbers are Different");

return 0;
}
[GHSS BHOWANA] Page 2 of 2

You might also like