Moumitama'amassignment 3
Moumitama'amassignment 3
#include<stdio.h>
#include<math.h>
int main()
{
int a,c,d;
float p,q,r;
printf("enter the number : ");
scanf("%f", &p);
a=p;
q=p-a;
r=q*100;
c=r;
d=c%10;
printf("the answer is : %d", d);
return 0;
}
#include<stdio.h>
#include<math.h>
int main ()
{
int a,b,c,d;
float p,q,r;
printf("enter the number : ");
scanf("%f", &p);
a=p;
q=p-a;
b=a%10;
c=a-b;
d=c/10;
r=d+q;
printf("the answer is : %f",r);
return 0;
}
Delete first digit after decimal
#include<stdio.h>
#include<math.h>
int main ()
{
int a,b;
float p,q,r,s,t;
printf("enter the number : ");
scanf("%f", &p);
a=p;
q=p-a;
r=q*10;
b=r;
s=r-b;
t=a+s;
printf("the answer is : %f" , t);
return 0;
}
return 0;
}
Insert 1 as digit before decimal
#include<stdio.h>
#include<math.h>
int main ()
{
int a,b,c;
float p,q,r;
printf("enter the number : ");
scanf("%f", &p);
a=p;
q=p-a;
b=a*10;
c=b+1;
r=c+q;
printf("the answer is : %f" , r);
return 0;
}
#include<stdio.h>
#include<math.h>
int main ()
{
int a,b;
float p,q,r,u,v;
printf("enter the number : ");
scanf("%f", &p);
a=p;
q=p-a;
r=10*q;
b=r;
printf("ans %d\n",b);
u=0.1*b;
v=p+u;
printf("the answer is : %f" ,v);
return 0;
}
Exchange the two digits before decimal
#include<stdio.h>
#include<math.h>
int main ()
{
int a,c,d,e,f,g,h;
float p,q,r;
return 0;
}
return 0;
}