50% found this document useful (4 votes)
11K views23 pages

Practical File On C

This document is a practical file on C language programs submitted for a class. It contains 10 programs demonstrating basic C language concepts like input/output, arithmetic operations, loops, strings, arrays, pointers, and more. Each program is accompanied by its source code and output. The programs provide examples of fundamental programming techniques in C.

Uploaded by

RUPESH KUMAR
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
50% found this document useful (4 votes)
11K views23 pages

Practical File On C

This document is a practical file on C language programs submitted for a class. It contains 10 programs demonstrating basic C language concepts like input/output, arithmetic operations, loops, strings, arrays, pointers, and more. Each program is accompanied by its source code and output. The programs provide examples of fundamental programming techniques in C.

Uploaded by

RUPESH KUMAR
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/ 23

An

Practical File
On
C Language
(Session 2020-21)

Submitted To: Submitted By:


Mr. Pankaj Dixit Name : Rohit Kumar

Class : BCA – 1st year


Roll no. : 201602014039

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()

float a, b, sum, sub, multi, div;

clrscr();

printf(“Enter any two no. which you want to calcuate”);

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();

printf(“Enter any value”);

scanf(“%f”,&a);

if(a%2==0)

printf(“It is even no.”);

else

printf(“It is odd no.”);

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()

char name[20], hobby[23];

clrscr();

scanf(“%s%s”,name,hobby);

printf(“name is %s \n hobby is %s \n”,name,hobby);

getch();

}
Output
Program-7
/* A Program on Leap Year*/

#include<stdio.h>

#include<conio.h>

void main()

int a;

clrscr();

printf(“enter any year”);

scanf(“%d”,&a);

if (a/4==0)

printf(“It is leap year”);

else

printf(“It is not a Leap year”);

getch();

}
Output
Program-8
/* A Program on Pointer*/

#include<stdio.h>

#include<conio.h>

void main()

int a,b,c,*m,*n;

clrscr();

printf(“enter two value”);

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];

int maths[6], SAD[5],LOC[8],total[10], i ;

clrscr();

for (i=0;i<=1;i++)

printf(“enter name\n”);

scanf(“%s”,&name*i+);

printf(“enter maths no.\n”);

scanf(“%d”,&maths[i]);

printf(“enter SAD no.\n”);

scanf(“%d”,&SAD[i]);

printf(“enter LOC no.\n”);

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();

printf(“enter any two values\n”);

scanf(“%d%d”,&a,&b);

printf(“before swapping the value\n”);

printf(“first no. =%d\n”,a);

printf(“Second no. =%d\n”,b);

c=a;

a=b;

b=c;

printf(“after swapping the value\n”);

printf(“first no. =%d\n”,a);

printf(“Second no. =%d\n”,b);

getch();

}
Output

You might also like