H
happytoday
Here it is a primitive conversion program from meter to
yards,inches,feets. Should I get the result of 1 inches when I enter
0.0245 meter.
#include "stdio.h"
#include "stdlib.h"
void input(float *);
void convert(float *,int *,int *,int *);
char another(void);
float main ()
{
int yards,feet,inches;
float meter;
do {
//system("clear");
input(&meter);
convert(&meter,&yards,&feet,&inches);
printf("\n %.4f meter is = %d yards %d feet %d inches
",meter,yards,feet,inches);
} while (another()=='y');
return 0;
}
void input(float *m)
{
printf("\nEnter size in meter :");
scanf("%f",m);
printf("\nYou have entered size in meter %.4f\n",*m);
}
void convert(float *m,int *y,int *f,int *i)
{
float remainder=0.0;
(remainder)=((*m) * 100.0) / 2.54;
*y=(remainder)/36.0;
(remainder)=(remainder)-(*y)*36.0;
*f=(remainder)/12.0;
*i=(remainder)-(*f)*12.0;
printf("\n %.4f meter is = %d yards %d feet %d inches ",*m,*y,*f,*i);
}
yards,inches,feets. Should I get the result of 1 inches when I enter
0.0245 meter.
#include "stdio.h"
#include "stdlib.h"
void input(float *);
void convert(float *,int *,int *,int *);
char another(void);
float main ()
{
int yards,feet,inches;
float meter;
do {
//system("clear");
input(&meter);
convert(&meter,&yards,&feet,&inches);
printf("\n %.4f meter is = %d yards %d feet %d inches
",meter,yards,feet,inches);
} while (another()=='y');
return 0;
}
void input(float *m)
{
printf("\nEnter size in meter :");
scanf("%f",m);
printf("\nYou have entered size in meter %.4f\n",*m);
}
void convert(float *m,int *y,int *f,int *i)
{
float remainder=0.0;
(remainder)=((*m) * 100.0) / 2.54;
*y=(remainder)/36.0;
(remainder)=(remainder)-(*y)*36.0;
*f=(remainder)/12.0;
*i=(remainder)-(*f)*12.0;
printf("\n %.4f meter is = %d yards %d feet %d inches ",*m,*y,*f,*i);
}