Practical File On C
Practical File On C
Practical File
On
C Language
(Session 2020-21)
Department of Management of
Computer Science,
Vaish College, Bhiwani
Index
S Particulars Remarks Signature
no.
1. A Simple Basic Program
2. A Program on Arithmetic
Operation
3. A Program on Even or Odd
Number
4. A Program on For Loop
5. A Program on While Loop
6. A Program on Simple String
7. A Program on Leap Year
8. A Program on Pointer
9. A Program on Simple Array
10. A Program on Swapping Value
Program -1
/* A simple Basic Program */
#include<stdio.h>
#include<conio.h>
void main()
clrscr();
printf(“Hello World”);
getch();
}
Output
Program-2
/* A Program on Arithmetic Operation*/
#include<stdio.h>
#include<conio.h>
void main()
clrscr();
scanf(“%f%f”,&a,&b);
sum=a+b;
sub=a-b;
multi=a*b;
div=a/b;
printf(“sum=%f\n”,sum);
printf(“subtraction=%f\n”,sub);
printf(“multiplication=%f\n”,multi);
printf(“division=%f\n”,div);
getch();
}
Output
Program-3
/* A Program on Even or Odd no.*/
#include<stdio.h>
#include<conio.h>
void main()
int a;
clrscr();
scanf(“%f”,&a);
if(a%2==0)
else
getch();
}
Output
Program-4
/* A Program on For Loop*/
#include<stdio.h>
#include<conio.h>
void main()
int a;
clrscr();
for (a=0;a<=10;a++)
printf(“\n%d”,a);
getch();
}
Output
Program-5
/* A Program on While Loop*/
#include<stdio.h>
#include<conio.h>
void main()
int a=1;
clrscr();
while(a<=20)
printf(“\n%d”,a);
a++;
getch();
}
output
t
Program-6
/* A Program on Simple String*/
#include<stdio.h>
#include<conio.h>
void main()
clrscr();
scanf(“%s%s”,name,hobby);
getch();
}
Output
Program-7
/* A Program on Leap Year*/
#include<stdio.h>
#include<conio.h>
void main()
int a;
clrscr();
scanf(“%d”,&a);
if (a/4==0)
else
getch();
}
Output
Program-8
/* A Program on Pointer*/
#include<stdio.h>
#include<conio.h>
void main()
int a,b,c,*m,*n;
clrscr();
scanf(“%d%d”,&a,&b);
m=&a;
n=&b,
c=*m+*n;
printf(“c is =%d”,c);
getch();
}
Output
Program-9
/* A Program on Array*/
#include<stdio.h>
#include<conio.h>
void main()
char name[9];
clrscr();
for (i=0;i<=1;i++)
printf(“enter name\n”);
scanf(“%s”,&name*i+);
scanf(“%d”,&maths[i]);
scanf(“%d”,&SAD[i]);
scanf(“%d”,&LOC[i]);
total[i]=maths[i]+SAD[i]+LOC[i];
printf(“total =%d\n”,total*i+);
}
getch();
}
Output
Program-10
/* A Program on Swapping value*/
#include<stdio.h>
#include<conio.h>
void main()
int a,b,c;
clrscr();
scanf(“%d%d”,&a,&b);
c=a;
a=b;
b=c;
getch();
}
Output