Professional Documents
Culture Documents
#include<stdio.h>
#include<conio.h>
void main()
{int n;
clrscr();
scanf("%d",&n);
if(n>=0)
{if(n>0)
{printf("number is positive");}
else
{printf("number is zero");}}
else
{printf("number is negative");}
getch();}
2.2.Write a program to read marks of a student from keyboard whether
the student is pass or fail.
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
int m;
clrscr();
scanf("%d",&m);
{if
(m>=23)
printf("Student is pass");
else
printf("Student is fail");
getch();
}
2.3.Write a program to read three numbers from keyboard & find out
maximum out of these three.
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
int A,B,C;
clrscr();
scanf("%d %d %d",&A,&B,&C);
{printf("A is maximum");}
else
{printf("B is maximum");
else
{printf("C is maximun");}
getch();
}
2.4 Write a C program to check whether the entered digit is Capital letter,
Small letter, any special character or symbol.
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
{char ch;
clrscr();
scanf("%c",&ch);
if(ch>=65&&ch<=90)
else if (ch>=97&&ch<=122)
else if (ch>=48&&ch<=57)
{ printf("Character is a digit");}
else if((ch>=0&&ch<=47)||(ch>=58&&ch<=64)||(ch>=91&&ch<=96)||(ch>=123&&ch<=126))
{ printf("Character is symbol");}
else
getch();}
2.5.Write a program to read marks from keyboard & your program should
display equivalent grade.(80 to 100=distinction,60 to 79=first class,40 to
59=second class,<40=fail)
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
float m;
clrscr();
printf("Enter marks:");
scanf("%f",&m);
{printf("Grade is disinction");}
else{printf("Student is fail");}
getch();
}
2.6.Write ac program to prepare pay slip using.(Da=10% of
basic,Hra=7.50% of basic,Ma=300,Pf=12.50% of
basic,Gross=basic+Da+Hra+Ma,Nt=Gross-Pf).
PROGRAM:
include<stdio.h>
#include<conio.h>
void main()
{float basic,du,hra,nu,pf,nt,gross;
clrscr();
scanf("%f",&basic);
du=basic*0.10;
hra=basic*0.07050;
pf=basic*0.1250;
nu=300;
gross=basic+du+hra+nu;
nt=gross=pf;
getch();}
2.7.Write a C program to read no 1 to 7 & print relativity day Sunday to
Saturday.
PROGRAM:
#include<stdio.h>
#include<conio.h>
void main()
{int ch;
clrscr();
scanf("%d",&ch);
{case1:printf("Monday");
break;
case2:printf("Tuesday");
break;
case3:printf("Wednesday");
break;
case4:printf("Thuursday");
break;
case5:printf("Friday");
break;
case6:printf("Saturday");
break;
case7:printf("Sunday");
break;
getch();}