C program to convert weight into grams

write a c program to convert weight into grams

Write an interactive program called WEIGHT CONVERTER that accepts the weight in milligrams decigrams centigrams kilograms ounces pounds tons and display in grams / write a c program to convert weight into grams

#include <stdio.h>
int q;
char u;
printf(” For converting weight into grams \n”);
printf( “enter weight quantity and its units \n m for milligrams \n c for centigrams \n k for kilograms \n o for ounces \n p for pounds \n t for tons \n);
scanf(“%d \n ” q);
printf(“unit of measurement:\t ” );
scanf(” %c \n”,u);
printf(“Weight in grams is %f”, weight_convert(t,u));

weight_convert(int i, char a);
if (a==m)
return float(i/1000);
if (a==c)
return float(i/100);
if (a==k)
return float(i*1000);
if (a==o)
return float(i*28.35);
if (a==p)
return float(i*453.59);
if (a==t)
return float(i*1000000);

Other programs:

Static variable scope
Register variable scope
External variable scope
Automatic variable scope
amicable number
Prime number
Perfect number
Palindrome number
Strong number
Find Factorial 
Biggest Number
Average of n numbers
convert decimal number to octal
decimal number to hexadecimal
decimal number to binary
simple interest
compound interest
Add sparce matrices
Add matrices
 file copying
Palindrome string
Reverse string
String length
Replace characters in string
substring or not using arrays
First occurrence of character in string
Last occurrence of character in string
Convert to uppercase
Convert to lowercase
Concatenate strings 
Compare strings
Generate Employee payslips
Count students scoring marks>50%
convert weight into grams


Leave a Reply

Your email address will not be published. Required fields are marked *