Q 3.
Program
#include <stdio.h>
int main()
float a;
int b,p,c;
printf("enter the number a=");
scanf("%f",&a);
p=a;//convert a into integer by taking only value of integral part
c=(p/10)%10;//if a=2819.568 then c=1
b=p%10;//if a=2819.568 then b=9
printf("the two right most digits of integral parts are c,d where
c=%d,b=%d",c,b);
return 0;
}
Q 3.4
program
#include <stdio.h>
int main()
float l,w,a,p;
printf("enter the length of rectangle=");
scanf("%f",&l);
printf("enter the widthth of rectangle=");
scanf("%f",&w);
a=l*w;
p=(l+w)*2;
printf("area =%f\n",a);
printf("perimeter =%f",p);
return 0;
output
Q 3.5
Program
#include<stdio.h>
int main()
int n,a,b,c,d;
printf("Enter a four digit number = ");
scanf("%d", &n);
a=(n/1000);
b=(n/100)%10;
c=(n/10)%10;
d=n%10;
printf("%d\n", n);
printf("%d%d%d\n", b,c,d);
printf("%d%d\n", c,d);
printf("%d\n", d);
return 0;
}
Q 3.9
program
#include <stdio.h>
#include<math.h>
int main()
float d,s,h,p,m,ebo,tbo;
printf("Demand rate =");
scanf("%f",&d);
printf("setup costs =");
scanf("%f",&s);
printf("Holding unit per unit time=");
scanf("%f",&h);
p=2*d*s/h;
ebo=pow(p,0.5);
m=2*s/h/d;
tbo=pow(m,0.5);
printf("ebo=%f",ebo);
printf("tbo=%f",tbo);
return 0;
output
Q 3.14
Program
#include<stdio.h>
int main()
int m,n;
printf("Enter m= ");
scanf("%d",&m);
printf("Enter n= ");
scanf("%d",&n);
(m%n==0)?printf("m is a multiple of n"):printf("m is a multiple of n");
return 0;
}
output
q 3.18
program
#include <stdio.h>
#include <math.h>
int main()
int i=10;
i<=100;
float x;
x=pow(i,0.5);
printf("____________________________\n");
printf("|NUMBER|SQUARE ROOT |SQUARE |\n");
printf("____________________________\n");
printf("| %d |%f |\t%d |\n",i,x,i*i);
printf("____________________________\n");
i=i+10;
x=pow(i,0.5);
printf("| %d |%f |\t%d |\n",i,x,i*i);
printf("____________________________\n");
i=i+10;
x=pow(i,0.5);
printf("| %d |%f |\t%d |\n",i,x,i*i);
printf("____________________________\n");
i=i+10;
x=pow(i,0.5);
printf("| %d |%f |\t%d|\n",i,x,i*i);
printf("____________________________\n");
i=i+10;
x=pow(i,0.5);
printf("| %d |%f |\t%d|\n",i,x,i*i);
printf("____________________________\n");
i=i+10;
x=pow(i,0.5);
printf("| %d |%f |\t%d|\n",i,x,i*i);
printf("____________________________\n");
i=i+10;
x=pow(i,0.5);
printf("| %d |%f |\t%d|\n",i,x,i*i);
printf("____________________________\n");
i=i+10;
x=pow(i,0.5);
printf("| %d |%f |\t%d|\n",i,x,i*i);
printf("____________________________\n");
i=i+10;
x=pow(i,0.5);
printf("| %d |%f |\t%d|\n",i,x,i*i);
printf("____________________________\n");
i=i+10;
x=pow(i,0.5);
printf("| %d |%f | %d|\n",i,x,i*i);
printf("____________________________\n");
i=i+10;
x=pow(i,0.5);
printf("| %d |%f | %d|\n",i,x,i*i);
printf("____________________________\n");
return 0;
}
OUTPUT