Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

#include<stdio.

h>

#include<conio.h> int fib(int); void main()

int i,n; clrscr();

printf("Enter the number for fibonacci series:\t"); scanf("%d",&n);

printf("The fibonacci series is :\n"); for(i=1;i<=n;i++)

printf("%d\t",fib(i));

getch();

int fib(int n)

if(n==1)

{return 0;

else if(n==2)

{return 1;} else

return(fib(n-1)+fib(n-2));

#include<stdio.h>

#include<conio.h> void main()

int zp,zg,m;

float cd,dp,dg,ha,hd,t,c,g; clrscr();


printf("Enter the number of teeth on pinion and gear ");

scanf("%d %d",&zp,&zg);

printf("enter module ");

scanf("%d",&m);

cd=m*(zp+zg)/2;

dp=m*zp;

dg=m*zg;

ha=m;

hd=1.25*m;

t=1.5708*m;

c=0.025*m;

g=zg/zp;

printf("\n centre distance %f',cd); printf("\n PCD of pinion and gear %f %f",dp,dg); printf("\n addendum
and dedendum %f %f",ha,hd); printf("\n tooth thickness %f,t);

printf("\n gear ratio %f',g); printf("\n clearance %f",c); getch();

#include<stdio.h>

#include<conio.h>

#include<math.h>

#include<graphics.h>

#include<stdlib.h>

#define PI=3.14 #define div=100 void main()

int gd= DETECT,gm,p,q,z,i,n;


float alfa, alfa1,zi,fi,m,R,Ra,Rb,Rr,S,x,y,w,theta;

float x1,y1,y2,x2,y3,x3,x4,y4,x5,y5,x6,y6;

printf("enter module, no. of teeth,pressure angle in rad");

scanf("%f %d %f",&n,&z,&f);

alfa = PI;

p=200; q=250;

zi=tan(fi)-fi;

R=m*z/2;

Ra=R+m;

Rb=R*cos(fi);

Rr=R-1.157*m;

theta=sqrt(Ra*Ra-Rb*Rb)/(Rb*div);

int graph (p,q,Rr);

circle(p,q,R);

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

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

w=Rb*n*theta;

r=p+Rb*cos(alfa-n*theta);

s=q+Rb*sin(alfa-n*theta);

x=r-w*sin(alfa-n*theta);

y=s+w*cos(alfa-n*theta);

put pixal(x,y,15);

x1=x; y1=y;

alfa=(alfa-(PI/z+2*z));

for(n=0;n<div;n++)
{

w=Rb*n*theta; r=p+Rb*cos(alfa1+n*theta); s=q+Rb*sin(alfa 1 +n*theta); x=r+w*sin(alfa 1 +n*theta);


y=s-w*cos(alfa1+n*theta); put pixal(x,y,14);

x2=x; y2=y;

line(x1,y1,x2,y2);

x3=p+Rb*cos(alfa);

y3=q+Rb*sin(alfa);

x4=P+Rr*sin(alfa);

y4=q+Rr*sin(alfa);

x5=p+Rb*cos(alfa);

y5=q+Rb*sin(alfa);

y6=q+Rr*sin(alfa);

line(x3,y3,x4,y4);

line(x5,y5,x6,y6);

alfa=alfa-2*PI/z;

getch(); close graph();

#include<math.h>

#include<conio.h> void main()

float fa=0,fr=0,Co=0,e=0,X=0,Y=0,P=0,l=0,n,C=0,a;

int v;

clrscr();
printf("Enter Fa,Fr,Co:”);

scanf("%f%f%f",&fa,&fr,&Co);

if((fa/Co>=0.025&&fa/Co<=0.040)||fa/Co<=0.025)

e=(((0.24-0.22)/(0.040-0.025))*((fa/Co)-0.025))+0.22;

else if(fa/Co>=0.040&&fa/Co<=0.070) e=(((0.27-0.24)/(0.070-0.040))*((fa/Co)-0.040))+0.24; else


if(fa/Co>=0.070&&fa/Co<=0.130) e=(((0.31-0.27)/(0.130-0.070))*((fa/Co)-0.070))+0.27; else
if(fa/Co>=0.130&&fa/Co<=0.250) e=(((0.37-0.31)/(0.250-0.130))*((fa/Co)-0.130))+0.31; else
if((fa/Co>=0.250&&fa/Co<=0.500)||fa/Co>=0.500) e=(((0.44-0.37)/(0.500-0.250))*((fa/Co)-0.250))+0.37;
else

printf("invalid input”); if(fa/fr<=e)

{X=1;

Y=0;

else

{X=0.56;

if((fa/Co>=0.025&&fa/Co<=0.040)||fa/Co<=0.025)

Y=(((1.8-2.0)/(0.040-0.025))*((fa/Co)-0.025))+2.0; else if(fa/Co>=0.040&&fa/Co<=0.070)

Y=(((1.6- 1.8)/(0.070-0.040))*((fa/Co)-0.040))+1.8; else if(fa/Co>=0.070&&fa/Co<=0.130)

Y=(((1.4- 1.6)/(0.130-0.070))*((fa/Co)-0.070))+1.6; else if(fa/Co>=0.130&&fa/Co<=0.250)

Y=(((1.2-1.4)/(0.250-0.130))*((fa/Co)-0.130))+1.4; else
if((fa/Co>=0.250&&fa/Co<=0.500)||fa/Co>=0.500)

Y=(((1.0- 1.2)/(0.500-0.250))*((fa/Co)-0.250))+1.2;

P=X*fr+Y*fa;

printf("Enter the value of L10: ”); scanf("%f",&l);

printf("For ball bearing press 1 and for roller bearing press 2:");

scanf("%d",&v);
if(v==1)

n=0.333333;

else if(v==2)

n=0.3;

else

printf("Invalid input"); a=pow(l,n);

C=P*a;

printf("Value of equivalent dynamic load: %f",P);

printf("\nValue of dynamic load capacity is: %f',C); getch();

#include<stdio.h>

#include<conio.h>

#define PI=3.14 void main()

int i,rpm;

float p,t,x,fs,w,bm,fb; printf("for design by torsion press /n"); printf("for design by bm press 2/n");
printf("for design by torque t and bm press 3/n"); scanf("%d",&i); switch {

casel;

printf("enter the value of power to be transmitted by the shaft and its rpm");

scanf"%f%d",&p&rpm);

t=(p*60)/(2*PI*rpm);

printf("enter the value of allowable shear stress for the material");

scanf("%f",&fs);

ds=pow(x,0.333)

printf("diameter of shaft=%F",ds);

break;
case2;

printf("enter the value of load"); scanf("%f",&w);

printf("enter the length of shaft");

scanf("%d",&l);

bm=w*l;

printf("enter max. bending stress "); scanf("%d",&fb); x=(bm*32)/PI*fb; ds=-pow(x,0.333);


printf("diameter of shaft = %f",ds);

getch();

clrscr();}

#include<stdio.h>

#include<conio.h>

#define PI=3.14

float torque(float d,float f);

void main()

float T,D,fs;

printf("/n enter the value of diameter in cm"); scanf("%f",&D);

printf("/n enter max. allowed shear stress N/mmA2"); scanf("f",fs);

T=torque (D,fs); printf("/n torque = %f",T);

float torque (float d, float f);

float t;

t=(PI/16)*d*d*d*f;
return(t);

getch();

clrscr();

You might also like