You are on page 1of 13

Experiment No:- 1 To Print Your Name And Adress

input
#include<stdio.h>
int main()
{
printf("Aniket Choudhari");
printf("At Post Pabal");
return 0;
}

Output

Aniket Choudhari At Post Pabal


--------------------------------
Process exited after 0.02581 seconds with return value 0
Press any key to continue . . .

Experiment no 1:-Compound Intrest

Input:-

#include<stdio.h>
#include<math.h>
int main()
{
float a,p=5000,t=5,r=10,ci;
a=p*pow((1+r/100),t);
ci=a-p;
printf("%f",ci);
return 0;
}

Output:-

3052.550781
Experiment no 1:-Simple Intrest

Input:-
#include<stdio.h>
#include<math.h>
int main()
{
int p=50000,t=5,r=7,si;
si=p*r*t/100;
printf("%d",si);
return 0;
}

Output:-

17500
--------------------------------
Process exited after 0.04442 seconds with return value 0
Press any key to continue . . .
Experiment no:-2 Switch Case
Input:

#include<stdio.h>
int main()
{
int a;
printf("1.addition\n");
printf("2.subtraction\n");
printf("3.multiplication\n");
printf("4.division\n");
printf("select correct option");
int b=10,c=5,d;
d=b+c;
int e=10,f=5,g;
g=e-f;
int h=10,i=5,j;
j=h*i;
int k=10,l=5,m;
m=k/l;
printf("select option");
scanf("%d",& a);
switch(a)
{
case 1:
printf("%d",d);
break;
case 2:
printf("%d",g);
break;
case 3:
printf("%d",j);
break;
case 4:
printf("%d",m);
break;
default:
printf("select right option");
}
return o;
}

Output:
1.addition
2.subtraction
3.multiplication
4.division
select correct optionselect option1
15
--------------------------------

Experiment No:- 3 Swap Two Number


Input:
#include<stdio.h>
int main()
{
int a=10,b=20,c;
printf("before swapping\n");
printf("%d %d\n",a,b);

c=a;
a=b;
b=c;
printf("after swapping\n");
printf("%d %d",a,b);
return 0;
}

Output:
before swapping
10 20
after swapping
20 10

Experiment no 4:- fibonacci serise


Input:
#include<stdio.h>
int main()
{
int n1=0,n2=1,n3,a,i;
printf("enter your value = ");
scanf("%d",&a);

printf("%d",n1);
printf("%d",n2);

for(i=2;i<a;i++)
{
n3=n1+n2;
printf("%d ",n3);
n1=n2;
n2=n3;

}
return 0;
}

Output:-
enter your value = 10
011 2 3 5 8 13 21 34
Experiment no 5:- prime number and not number

Input:
#include<stdio.h>
int main()
{
int a;
printf("enter the value");
scanf("%d",&a);
if(a==1)
{
printf("is not a prime numer");
goto demo;
}
if(a==2)
{
printf("it is a prime number");
goto demo;
}
if(a%2==0)
{
printf("it is not prime number");
}
else
{
printf("it is prime number\n");
}
demo:
{
printf("\nend of program");
}
return 0;

Output:-

enter the value20


it is not prime number
end of program
Experiment no -8

#include<stdio.h>

int main()

int a=5;

int*p=&a;

printf("%d\n",a);

printf("%p\n",&a);

printf ("%d\n",*p);

printf ("%p\n",&p);

Output :

0062FE9C

0062FE98
EXPERIMENT NO:- 09
#include<stdio.h>

int main()

FILE*f;

f=fopen("f://demo.text","w");

fprintf(f,"file handling");

fclose(f);

f=fopen("f://demo.text","r");

char a[100];

fgets(a,100,f);

printf("%s",a);

fclose(f);

OUTPUT:-
file handling
EXPERIMENT NO:-10
#include<stdio.h>

void add();

void sub();

void mul();

void div();

int main()

int a;

printf("cal\n");

printf("1.add\n");

printf("2.sub\n");

printf("3.mul\n");

printf("4.div\n");

printf("enter option\n");

scanf("%d",&a);

switch(a)

case 1:

add();

break;

case 2:

sub();

break;

case 3:

mul();

break;

case 4:

div();

break;

default:

printf("invalid\n");

}
void add()

int b,c,d;

printf("Enter first no\n");

scanf("%d",&b);

printf("Enter second no\n");

scanf("%d",&c);

d=b+c;

printf("%d",d);

void sub()

int e,f,g;

printf("enter first no\n");

scanf("%d",&e);

printf("enter second no\n");

scanf("%d",&f);

g=e-f;

printf("%d",g);

void mul()

int h,i,j;

printf("enter first no\n");

scanf("%d",&h);

printf("enter second no\n");

scanf("%d",&i);

j=h*i;

printf("%d",j);

void div()

int k,l,m;

printf("enter first no\n");

scanf("%d",&k);

printf("enter second no\n");


scanf("%d",&l);

m=k/l;

OUTPUT:-

cal

1.add

2.sub

3.mul

4.div

enter option

enter first no

enter second no

12

-4
Experiment no – 6

#include<stdio.h>

int main()
{
int i,j,t;
int a[5]={30,60,25,37,45};
for (i=0;i<5;i++)
{
for (j=0;j<5;j++)
{
if (a[i]>a[j]);
{

t=a[i];
a[i]=a[j];
a[j]=t;
}
}

}
for (i=0;i<5;i++)
{
printf (" %d ",a[i]);
}

return 0;
}

Output :
25 37 45 30 60
EXPERIMENT NO 7

#include<stdio.h>

struct stud

int r;

char a[100];

float s1;

float s2;

float s3;

float s4;

float p;

}s;
int main()

printf("enter info");

printf("enter roll number");

scanf("%d",&s.r);

printf("enter the name");

scanf("%s",&s.a);

printf("enter the marks of subject");

scanf("%f",&s.s1);

printf("enter the marks of subject");

scanf("%f",&s.s2);

printf("enter the marks of subject");

scanf("%f",&s.s3);

printf("enter the marks of subject");

scanf("%f",&s.s4);
printf("display information ");

printf("roll

number=%d",s.r);

printf("name=%s",s.a);

s.p=((s.s1+s.s2+s.s3+s.s4)/400)*10

0;printf("%f",s.p);

return 0;

enter info

enter roll number1

enter the namedd

enter the marks of subject50

enter the marks of subject50

enter the marks of subject50

enter the marks of subject50

display information roll

number=1name= Gaurav

Bhamare 50.000000

You might also like