You are on page 1of 8

______________

J . K . M . ___________
10 - EARTH

Smt.L.P Savani Vidhyabhavan


Subject :- Computer Practical Std :10th

Pr1. Print Hello


#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf("Hello World");
getch();
}

Pr2. Addition of two values


#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a=10;
int b=20;
int c;
c=a+b;
printf("Addition=%d",c);
getch();
}

Pr3. Take a value from the user and Addition of their two values
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
printf("Enter Value of a=");
scanf("%d",&a);
printf("Enter Value of b=");
scanf("%d",&b);
c=a+b;
printf("Addition=%d",c);
getch();
}

Pr4. Take a value from the user and Addition of their two values
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
printf("Enter Value of a=");
scanf("%d",&a);
printf("Enter Value of b=");
scanf("%d",&b);
c=a+b;
printf("Addition=%d",c);
getch();
}

Pr5. Take a value from the user and Swapping the values.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
printf("Enter Value of a=");
scanf("%d",&a);
printf("Enter Value of b=");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf("Value of a=%d",a);
printf("Value of b=%d",b);
getch();
}
Pr6. Take a value from the user and perform simple intrest.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int p,r,n;
float i;
printf("Enter price=");
scanf("%d",&p);
printf("Enter rate=");
scanf("%d",&r);
printf("Enter Duration=");
scanf("%d",&n);
i=p*r*n/100;
printf("Simple intrest=%.2f",i);
getch();
}

Pr7. Take a value from the user and find area of room.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int len,wid,area;
printf("Enter Length=");
scanf("%d",&len);
printf("Enter Width=");
scanf("%d",&wid);
area=len*wid;
printf("Area of room =%d",area);
getch();
}

Pr8. Take a value from the user and find average of given marks.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int mat,sci,ss,tot;
float per;
printf("Enter Marks out of 100=");
printf("Maths=");
scanf("%d",&mat);
printf("Science=");
scanf("%d",&sci);
printf("Social Science=");
scanf("%d",&ss);
tot=mat+sci+ss;
per=tot/3;
printf("Total Marks =%d",tot);
printf("Percentage =%.2f",per);
getch();
}

Pr9 Compare two numbers.


#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
printf("Enter Value of a=");
scanf("%d",&a);
printf("Enter Value of b=");
scanf("%d",&b);
if(a>b)
{
printf("A is Big");
}
else
{
printf("B is Big");
}
getch();
}
Pr10. Check the number is even or odd.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int num;
printf("Enter Number=");
scanf("%d",&num);
if(num%2 == 0)
{
printf("is Even Number");
}
else
{
printf("is Odd Number");
}
getch();
}

Pr11. Check the year is leap year or not.


#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int year;
printf("Enter Year=");
scanf("%d",&year);
if(year%4 == 0)
{
printf("is Leap Year");
}
else
{
printf("is Not Leap Year");
}
getch();
}
Pr12. Check User is Pass or Fail.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int mat,sci,ss,tot;
float per;
printf("Enter Marks out of 100=");
printf("Maths=");
scanf("%d",&mat);
printf("Science=");
scanf("%d",&sci);
printf("Social Science=");
scanf("%d",&ss);
tot=mat+sci+ss;
per=tot/3;
printf("Total Marks =%d",tot);
printf("Percentage =%.2f",per);
if(per >40)
{
printf("Pass");
}
else
{
printf("Fail");
}
getch();
}

Pr13. Assign a grade based on result.


#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int mat,sci,ss,tot;
float per;
printf("Enter Marks out of 100=");
printf("Maths=");
scanf("%d",&mat);
printf("Science=");
scanf("%d",&sci);
printf("Social Science=");
scanf("%d",&ss);
tot=mat+sci+ss;
per=tot/3;
printf("Total Marks =%d",tot);
printf("Percentage =%.2f",per);
if(mat >40 && sci >40 && ss>40)
{
if(per >70)
{
printf("Distinction");
}
else if(per >60)
{
printf("1st Class");
}
else if(per >50)
{
printf("2nd Class");
}
else if(per >40)
{
printf("Pass");
}
else
{
printf("Fail");
}
}
else
{
printf("Fail");
}
getch();
}
Pr14. Perform Arithmetic using switch case.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c,ch;
printf("Enter Value of a=");
scanf("%d",&a);
printf("Enter Value of b=");
scanf("%d",&b);
printf("1. Addition");
printf("2. Subtraction");
printf("3. Multiplication");
printf("4. Division");
printf("Please Select Your Choice=");
scanf("%d",&ch);
switch(ch)
{
case 1 :
c=a+b;
printf("Addition=%d",c);
break;
case 2 :
c=a-b;
printf("Subtraction=%d",c);
break;
case 3 :
c=a*b;
printf("Multiplication=%d",c);
break;
case 4 :
c=a/b;
printf("Division=%d",c);
break;
default :
printf("Invalid Choice");
}
getch();
}

You might also like