| | 0 comments

:. B.Tech (SEC_A) PDS .:




LAB_1:

PROBLEM 1:


#include
main(){
printf(“I am an Indian\n”);
printf(“\”I am an Indian\”\n”);
printf(“*I am an Indian*\n”);
}


*********************************************


PROBLEM 2 :



#include

main()
{
int num,sum=0,mult=1,a,b;

printf(“Enter your integer: “);

scanf(“%d”,&num);

int div,sub;

while(num>=1)
{
a=num%10;

sum=sum+a;

mult=mult*a;

num=(num-a)/10;

}
printf(“%d\n%d\n”,sum,mult);
}


**************************************************

PROBLEM 3 :




#include

main()
{
int a=1,n,i=0,b=1;

printf(“Enter your range: “);

scanf(“%d”,&n);

while(a<=n) { while(b<=a) { if(a%b==0) { i=i+1; } b=b+1; } if(i==2) { printf(“%d\t”,a); } a=a+1; b=1; i=0;} printf(“\n”); } ***************************************

PROBLEM 4 :




#include

#include

#define pi 3.14

main()
{
int r;

printf(“Enter the radius of the circle: “);

scanf(“%d”,&r);

printf(“Area of the circle= %f\nPerimeter of the circle= %f\n”,pi*r*r,2*pi*r);

int s;

printf(“Enter the side of the square: “);

scanf(“%d”,&s);

printf(“Area of the square= %d\nPerimeter of the square= %d\n”,s*s,4*s);

int a,b,c;

printf(“Enter the 3 sides of the triangle:\n”);

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

int t=(a+b+c)/3;

printf(“Area of the triangle= %f\nPerimeter of the triangle= %d\n”,sqrt(t*(t-a)*(t-b)*
(t-c)),a+b+c);


int l;

printf(“Enter length and bredth of the rectangle :\n”);

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

printf(“Area of the rectangle= %d\nPerimeter of the rectangle= %d\n”,l*b,2*(l+b));

printf(“Enter the major axes and minor axes :\n”);

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

printf(“Area of the Ellipse= %f\nPerimeter of the Ellipse= %f\n”,pi*(a*b),pi*sqrt((a*a+b*b)/2));
}




**************************************

LAB_2:

PROBLEM 1 :




#include

main()
{
int a,b,c,d,e,y;

scanf(“%d”,&y);

a=y*(2/2);b=y*(4/24);c=y*(6/720);d=y*(8/40320);e=y*(10/3628800);

printf(“%d”,1-a+b-c+d-e);
}




******************************






#include

main()
{
int a1,b1,c1,d1,a2,b2,c2,d2;

scanf(“%d %d %d %d”,&a1,&b1,&c1,&d1);

scanf(“%d %d %d %d”,&a2,&b2,&c2,&d2);

if(a1<=c2 && a2<=c1 && b1<=d2 && b2<=d1) { printf(“Two rectangles are Intersect”); } else { printf(“Two rectangles doesn’t Intersect”); } } *******************************************

PROBLEM 3 :




#include

#include

main()

{
int a=1,b=2,c=3;

int m,n;

m=-b+sqrt(b*b-4*a*c)/2*a;

n=(-b-(sqrt((b*b)-(4*a*c)))/2*a);

printf(“%d %d\n”,m,n);
}





***********************************


PROBLEM 4 :



#include

#include

main()
{
int a,b,c,x,y,d,e,z;

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


printf(“\nsum=%d\n”,a+b+c);

printf(“\navg is=%d\n”,(a+b+c)/2);

}

{
if(a>b && a>c)

printf(“\ngreater is=%d\n”,a);

else if(ab) && c>b)

printf(“\nsmaller is=%d\n”,b);
else

printf(“\nsmaller is=%d\n”,c);
}
{

x=a+b+c/3;

y=pow(a-x,a-x);

z=pow(b-x,b-x);

d=pow(c-x,c-x);

e=y+z+d/3;

printf(“%d\n”,y);

}
}




*************************************************



PROBLEM 5 :





#include

main()
{
int a=0,b=1,x=1,n,i=1;

scanf(“%d”,&n);

while(i<=n) { printf(“%d\t”,x); a=b; b=x; x=a+b; i=i+1; } printf(“\n”); } ***********************************************

LAB_3:





#include

main()
{
int a;

scanf(“%d”,&a);

int b[a],c=0;

while(cf[h1+1]){h=h;
}
else{h=f[h1+1];
}
h1=h1+1;
}
printf(“%d”,h);
}




**************************************************



PROBLEM 2 :




#include

main()
{
int a,b,c;

printf(“Enter a Integer :”);

scanf(“%d”,&a);

while(a>1)
{
printf(“%d\t”,a);

if(a%2==0)
{
a=a/2;
}
else
{
a=3*a+1;
}
}
printf(“\n”);
}





*********************************************************


PROBLEM 3:



#include

main()
{
int num;

scanf(“%d”,&num);

int normal(a)
{
int b=1,c;

while(a>=1)
{
while(b<=a) { printf(“%d”,b); if(b==a) { while(b>=1)
{
printf(“%d”,b);
b=b-1;
}
break;
}
b=b+1;
}
printf(“\n”);
b=1;
a=a-1;
}}
int middle(a)
{
int b=1,c,d=1;

while(a>=1){
while(b<=a) { printf(“%d”,b); if(b==a) { b=b-1; while(b>=1)
{
printf(“%d”,b);b=b-1;
}
break;
}
b=b+1;
}
printf(“\n”);

b=1;

while(b<=d){printf(” “);b=b+1;} b=1; a=a-1; d=d+1; } } normal(num); printf(“\n\n\n”); middle(num); printf(“\n”); }