BASIC UNIT CONVETOR

 Source Code for Basic Unit Converter


For bca students 👉bca-wala.blogspot.com

About Source Code:-

--Forgot how to convert degree Fahrenheit to Celsius? Don’t worry. We have a solution for you. This unit converter converts basic units such as temperature, currency, and mass.

Source Code is given below:-

#include<stdio.h>
#include<conio.h>
void main()
   {
 char category;
 int tempChoice;
 int currencyChoice;
 int massChoice;
 int userinputF;
 int userinputC;
 int userinputUSDtoEuro;
 int userinputUSDtoJPY;
 int userinputUSDtoRMB;
 int userinputOunce; 
 int userinputGram;
 int fahrenheitToCelcius;
 int celciusToFahrenheit;
 float USDtoEURO;
 float USDtoJPY;
 float USFtoRMB;
 float ounceToPounds;
 float gramsToPound;
 clrscr();
 printf("Welcome to Unit Converter! \n");
 printf("Here is a list of conversion to choose from: \n");
 printf("Temperature(T),Currency(C),Mass(M) \n");
 printf("Please enter the letter you want to convert. \n");
 scanf("%c",&category);
   if(category =='T'){
        printf("Welcome to Temperature Converter! \n");
        printf("Here is a list of conversation to choose from: \n");
        printf("Enter 1 for Fahrenheit to Celsius. \n");
        printf("Enter 2 for Celsius to Fahrenheit. \n);
        scanf("%d",&tempChoice);
          if(tempChoice ==1)
          {
              printf("Please enter the Fahrenheit degree: \n);
              scanf("%d",&userinputF);
              fahrenheitToCelcius = ((userinputF-32)*(5.0/9.0));
              printf("Celcius: %d",fahrenheitToCelcius);
          } 
         else if(tempChoice == 2)
          {
              printf("Please enter the Celcius degree: \n");
              scanf("%d",&userinputC);
              celciusToFahrenheit = ((9.0/5.0)*userinputC+32);
              printf("Fahrenheit: %d",celciusToFahrenheit);
          }
        else 
             printf("Please enter the correct choice. \n");
          }
   else if(category =='C'){
        printf("Welcome to Currency Converter! \n");
        printf("Here is a list of conversation to choose from: \n");
        printf("Enter 1 for USD to Euro. \n");
        printf("Enter 2 for USD to JPY. \n);
        printf("Enter 3 for USD to RMB. \n");
        scanf("%d",&currencyChoice);
          if(currencyChoice == 1)
           {
              printf("Please enter the USD amount: \n");                                                                                        scanf("%d",&userinputUSDtoEuro);
              USDtoEURO = userinputUSDtoEuro * 0.87;
              printf("Euro: &.2f",USDtoEURO);
           }
          else if(currencyChoice == 2)
           {
              printf("Please enter the USD amount: \n");
              scanf("%d",&userinputUSDtoJPY);
              USDtoJPY = userinputUSDtoJPY * 111.09;
              printf("JPY: %.2f",USDtoJPY);
           }
         else if("currencyChoice == 3)
          {
             printf("Please enter the USD amount: \n");
             scanf("%d",&userinputUSDtoRMB);
             USDtoRMB = userinputUSDtoRMB * 6.82;
             printf("RMB: %.2f",USDtoRMB);
          }
        else
            printf("Please enter correct choice. \n");
      }
   else if(category =='M') {
        printf("Welcome to Mass Converter! \n");
        printf("Here is a list of conversations to choose from: \n");
        printf("Enter 1 for ounces to pounds. \n");
        printf("Enter 2 for gram to pounds. \n");
        scanf("%d",&massChoice);
          if(massChoice == 1)
           {
              printf("Please enter the ounce amount: \n");
              scanf("%d",&userinputOunce);
              ounceToPounds = userinputOunce * 0.0625;
              printf("Pounds: %.2f",ounceToPounds);
           }
         else if(massChoice == 2)
          {
             printf("Please enter the gram amount: \n");
             scanf("%d",&userinputGram);
             gramsToPounds = userinputGram * 0.00220462;
             printf("Pounds: %.2f",gramsToPounds);
          }
        else
            printf("Please enter the correct choice. \n");
         }
   getch();
     }




For more Details go on that website bca-wala.blogspot.com


If you want to do projects work in C Language. So << visit it >> here you see 15+ projects with there source codes. All Projects divided into three parts such as Beginner, Intermediates, Advance.


All things are write by Ankit Rai urf Ankit King😅
Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.