Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

NAME :- Shreyas Chore

Roll No :- SYETA123

Title:-//Area of circle//

#include<stdio.h>

#include<conio.h>

#define pi 3.14

int main()

float radius,area;

printf("Radius of circle is :-\n");

scanf("%d",&radius);

area = pi*radius*radius;

printf("Area of circle is :-%f\n",area);

return 0;

OUTPUT:
Radius of circle is :-
2
Area of circle is :-12.560000

Process returned 0 (0x0) execution time : 1.917 s


Press any key to continue.
NAME :- Shreyas Chore

Roll No :- SYETA123

Title:- //Factorial of number//

#include <stdio.h>

#include <stdlib.h>

int main()

int a,fact=1,n;

printf("Enter the number:");

scanf("%d",&n);

for(a=1;a<=n;a++)

fact=fact*a;

printf("Factorial of given number is :%d",fact);

return 0;

OUTPUT:

Enter the number:5

Factorial of given number is :120

Process returned 0 (0x0) execution time : 3.632 s

Press any key to continue.


NAME :- Shreyas Chore

Roll No :- SYETA123

Title:-//if else program//

#include <stdio.h>

#include <stdlib.h>

int main()

{ int a =40 , b= 50, c= 60;

if (a>b>c)

printf(" a is a largest number");

else if (b>c>a)

printf("b is largest number");

else

{printf("c is largest number");

OUTPUT:

c is largest number
NAME :- Shreyas Chore

Roll No :- SYETA123

Title:- // Formation of Matrix//

#include <stdio.h>

#include <conio.h>

int. main()

int a[10][10],i,j;

int r,c;

printf(" ENTER THE NUMBER OF ROWS:");

scanf("%d",&r);

printf("ENTER THE NUMBER OF COLUMN:");

scanf("%d",&c);

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

for(j=0;j<c;j++)

scanf("%d",&a[i][j]);

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

for(j=0;j<c;j++)

printf("%d",a[i][j]);

printf("\n");

return 0;

OUTPUT:

ENTER THE NUMBER OF ROWS:2

ENTER THE NUMBER OF COLUMN:2

5
6

25

67

Process returned 0 (0x0) execution time : 13.494 s

Press any key to continue.


NAME :- Shreyas Chore

Roll No :- SYETA123

Title:- //Menu card//

#include <stdio.h>

#include <stdlib.h>

int main()

int a,quantity,rate,total;

printf("Please select your choice\n 1].Cofffe\n 2].Tea\n 3].Milk\n");

scanf("%d",&a);

switch(a)

case 1:

printf("You selected a coffee\n please enter the quantity:-");

scanf("%d",&quantity);

rate=10;

total=rate*quantity;

printf("You have to pay Rs:%d",total);

break;

case 2:

printf("You selected a Tea\n please enter the quantity:-");

scanf("%d",&quantity);

rate=5;

total=rate*quantity;

printf("You have to pay Rs:%d",total);

break;

case 3:

printf("You selected a Milk\n please enter the quantity:-");


scanf("%d",&quantity);

rate=10;

total=rate*quantity;

printf("You have to pay Rs%d",total);

break;

return 0;

OUTPUT:

Please select your choice

1].Cofffe

2].Tea

3].Milk

You selected a Tea

please enter the quantity:-2

You have to pay Rs:10

Process returned 0 (0x0) execution time : 8.152 s


NAME :- Shreyas Chore

Roll No :- SYETA123

Title:- //Pyramid//

#include <stdio.h>

#include <stdlib.h>

int main()

int j ,i;

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

{for(j=1;j<=i;j++)

{ printf("*");

printf("\n");

return 0;

OUTPUT:

**

***

****

*****

Process returned 0 (0x0) execution time : 0.018 s

Press any key to continue.


NAME :- Shreyas Chore

Roll No :- SYETA123

Title:- //Reverse of number//

#include <stdio.h>

#include <stdlib.h>

int main()

int n,sum =0,a;

printf("Enter the number:");

scanf("%d",&n);

while(n>0)

a=n%10;

sum=((sum*10)+a);

n=n/10;

printf("Reverse of given number is : %d",sum);

return 0;

OUTPUT: Enter the number:56

Reverse of given number is : 65

Process returned 0 (0x0) execution time : 2.319 s

Press any key to continue.


NAME :- Shreyas Chore

Roll No :- SYETA123

Title:- //Sum of adjecent number//

#include<stdio.h>

#include<conio.h>

int main()

int a, sum=0, n;

printf("ENTER THE NUMBER: ");

scanf("%d", &a);

while(a>0)

n= a % 10;

sum = sum + n;

a = a/ 10;

printf("Sum of digits : %d",sum);

return 0;

OUTPUT:- ENTER THE NUMBER: 56

Sum of digits : 11

Process returned 0 (0x0) execution time : 2.109 s

Press any key to continue.


NAME :- Shreyas Chore

Roll No :- SYETA123

Title:- //Sum of digits//

#include<stdio.h>

#include<conio.h>

int main()

int a ,b ,sum;

printf(" Enter the number :");

scanf("%d",&a);

printf("Enter the second number:");

scanf("%d",&b);

sum=a+b;

printf("sum of two number:%d",sum);

return 0;

OUTPUT:- Enter the number :56

Enter the second number:5

sum of two number:61

Process returned 0 (0x0) execution time : 6.172 s

Press any key to continue.

• //Addition of Matrix//

#include<stdio.h>

#include<conio.h>

int main()

int m, n, c, d, first[10][10], second[10][10], sum[10][10];

printf("Enter the number of rows and columns of matrix :");

scanf("%d%d", &m, &n);

printf("\nEnter the elements of first matrix : \n");


for (c = 0; c < m; c++)

for (d = 0; d < n; d++)

scanf("%d", &first[c][d]);

printf("\nEnter the elements of second matrix : \n");

for (c = 0; c < m; c++)

for (d = 0; d < n; d++)

scanf("%d", &second[c][d]);

printf("\nSum of entered matrices : \n");

for (c = 0; c < m; c++)

for (d = 0; d < n; d++)

sum[c][d] = first[c][d] + second[c][d];

printf("%d\t", sum[c][d]);

printf("\n");

return 0;
}

OUTPUT:

Enter the number of rows and columns of matrix :2

Enter the elements of first matrix :

Enter the elements of second matrix :

Sum of entered matrices :

6 8

12 8

Process returned 0 (0x0) execution time : 15.355 s

Press any key to continue.

You might also like