0% found this document useful (0 votes)
23 views

C Language

The document contains code snippets for 4 C programs that check different conditions: 1) checks if a number is odd or even, 2) checks if a number is positive or negative, 3) checks if a year is a leap year, 4) checks if a character is a vowel or consonant.

Uploaded by

Harveer Singh
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)
23 views

C Language

The document contains code snippets for 4 C programs that check different conditions: 1) checks if a number is odd or even, 2) checks if a number is positive or negative, 3) checks if a year is a leap year, 4) checks if a character is a vowel or consonant.

Uploaded by

Harveer Singh
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
You are on page 1/ 4

1).

WAP to check odd even number

#include<stdio.h>

#include<conio.h>

int main()

int n;

printf("Enter odd and even number");

scanf("%d",&n);

if(n%2==0)

printf("Even number:");

else

printf("Even number")

printf("Odd number: ");

getch();

2).W.A.P to check positive and negative number

#include<stdio.h>

#include<conio.h>

int main()
{

int number,number1;

printf("Enter positive and negative number");

scanf("%d %d",&number,&number1);

if(number>0)

printf("Positive number");

else

printf("Negative number");

getch();

3). W.A.P to check leap year.

#include<stdio.h>

#include<conio.h>

int main()

int year;

printf("Enter leap year");

scanf("%d",&year);

if(year%4==0)

{
printf("leap year");

else

printf("Not leap year");

getch();

4). W.A.P to check character vowels and cons…

#include<stdio.h>

#include<conio.h>

int main()

char c;

printf("Enter the characters values");

scanf("%c",&c);

if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')

printf("Consonents character");

else

{
printf("Vowels character");

getch();

return 0;

You might also like