0% found this document useful (0 votes)
20 views23 pages

Programming in C (Practical) Dibyendu Patra

The document contains practical programming exercises in C for a student named Dibyendu Patra at Vidyasagar University for the session 2024-2025. It includes ten programs covering basic concepts such as arithmetic operations, loops, strings, leap year determination, pointers, arrays, and value swapping. Each program is accompanied by its code and expected output.

Uploaded by

patradibyendu690
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)
20 views23 pages

Programming in C (Practical) Dibyendu Patra

The document contains practical programming exercises in C for a student named Dibyendu Patra at Vidyasagar University for the session 2024-2025. It includes ten programs covering basic concepts such as arithmetic operations, loops, strings, leap year determination, pointers, arrays, and value swapping. Each program is accompanied by its code and expected output.

Uploaded by

patradibyendu690
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

VIDIYASAGAR UNIVERSITY

NAME: DIBYENDU PATRA

SUBJECT: PROGRAMMING IN C (PRACTICAL)

ROLL: NO:

REG. NO: VU241380094

SESSION: 2024-2025
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