0% found this document useful (0 votes)
13 views4 pages

Practical

Uploaded by

timeschalchitra
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)
13 views4 pages

Practical

Uploaded by

timeschalchitra
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/ 4

Practical-1

1. Print your name.


#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf(“my name is kiran”);
getch();
}

OUTPUT:
my name is kiran

2. Print full name in 2 lines.


#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf(“my name is kiran\npachlasiya”);
getch();
}
OUTPUT:
my name is kiran
pachlasiya

3. Print your name in the center of the screen.

4. Print some patterns using ‘\n’.


#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
printf(“my name is kiran\nkira\nkir\nki\nk”);
getch();
}
OUTPUT:
Kiran
Kira
Kir
Ki
k

5. Print some patterns using ‘\t’.


#include<stdio.h>
#include<conio.h>
void main()
{
Clrscr();
Printf(“my name is kiran\tkira\tkir\tki\tk”);
getch();
}
OUTPUT:
kiran kira kir ki k

Practical-2
6. Add 2 numbers.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
Clrscr();
Printf(“enter two numbers”);
Scanf(“%d%d”,&a,&b);
sum=a+b;
Printf(“addition = %d”,sum);
getch();
}
OUTPUT:
Enter two numbers32
4
addition=36

7. Find average of 3 numbers.


#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
float avg;
clrscr();
printf(“enter three numbers”);
scanf(“%d%d%d”,&a,&b,&c);
avg=(a+b+c)/3
Printf(“average of three no. = %f”,avg);
getch();
}
OUTPUT:
Enter three numbers32
32
32
Average of three no. =32

8. Find area of rectangle and circle.


#include<stdio.h>
#include<conio.h>
void main()
{
int l,b;
Clrscr();
Printf(“enter two numbers”);
Scanf(“%d%d”,&l,&b);
area=l*b;
Printf(“area of rectangle = %d”,area);
getch();
}
OUTPUT:
Enter two numbers3
3
area of rectangle = 9

#include<stdio.h>
#include<conio.h>
void main()
{
int r;
float area;
Clrscr();
Printf(“enter the value”);
Scanf(“%d”,&r);
area=3.14*r*r;
Printf(“area of circle = %f”,area);
getch();
}
OUTPUT:
Enter the value3
area of circle = 28.26

9. Swap 2 numbers using 3rd variable.

#include<stdio.h>
#include<conio.h>
void main()
{
int r;
float area;
Clrscr();
Printf(“enter the value”);
Scanf(“%d,%d”,&a,&b);
Printf(“\nvalues before swapping\n a =%d\nb=%d”,a,b);
temp=a;
a=b;
b=temp;
Printf(“\n values after swapping\n a= %d\n b=%d,a,b);
getch();
}
OUTPUT:
enter the value12
5
value before swapping
a=12
b=5
value after swapping
a=5
b=12
10. Swap 2 numbers without 3rd variable

You might also like