Technocrat

  • Home

Friday, September 5, 2014

C program for Unit Conversion

 Sumit Kar     September 05, 2014     C - Programming     No comments   



Unit Conversion,Celsius, Fahrenheit, Sumit Kar, Timus Rak, Feet, KM, Meter, cm, mm,






/* Convert Celsius to Fahrenheit */




#include<stdio.h>

void main()

{

    float c,f;

    printf("Enter the temperature in Celcius: ");

    scanf("%f",&c);

    f = c * 9/5 + 32;

    printf("Temperature in Farenheit: %f",f);

}












/* Convert Farenheit to Celcius */






#include<stdio.h>

void main()

{

    float c,f;

    printf("Farenheit : ");

    scanf("%f",&f);

    c = (f - 32) * 5/9;

    printf("Celcius: %f",c); 



}








/*Convert Meter to Feet*/






#include<stdio.h>

void main()

{

    float m,f;

    printf("Meter : ");

    scanf("%f",&m);

    f = 3.2808399 * m;

    printf("Feet: %f",f);

}












/* Convert Feet to Meter */






#include<stdio.h>

void main()

{

    float m,f;

    printf("Feet : ");

    scanf("%f",&f);

    m = f / 3.2808399;

    printf("Meter: %f",m);

}










/*Convert Km to M/cm/mm*/






#include<stdio.h>

void main()

{

  float km;

  char v;

  float ans;



  printf("K.M. : ");

  scanf("%f",&km);

  printf("KM will be changed in (M=Meter, c=Centimeter,m=milimeter) : ");

  fflush(stdin);

  scanf("%c",&v);

  if(v=='M')

     ans=km*1000;

  if(v=='c')

     ans=km*100000;

  if(v=='m')

     ans=km*1000000;

  printf("Answer : %.2f",ans);  

}






/*C Program to convert AC to DC and vice versa*/


# include <stdio.h>

 int main()

 {

     int choice; 

     float ac=0.0,dc=0.0;

     printf("Menu \n 1.AC to DC \n 2.DC to AC \n Enter Choice:"); 

     scanf("%d",&choice); 

     

     switch(choice) 

        { 

        case 1: printf("Enter AC current: "); 

                  scanf("%f",&ac);

                  dc=ac*0.636;

                  printf("AC=%f, DC=%f",ac,dc);

                  break; 

        case 2: printf("Enter DC current: "); 

                  scanf("%f",&dc);

                  ac=dc/0.636;

                  printf("AC=%f, DC=%f",ac,dc);

                 break; 

         default:printf("Error!"); 

                   break; 

        } 

    return 0; 

 }






















  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
  •  WhatsApp
Email ThisBlogThis!Share to TwitterShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Pages

  • Home

Trending Now

  • Write a Program to Add two 3x3 Matrix using C
    #include<stdio.h> void main () { int a [ 3 ][ 3 ], b [ 3 ][ 3 ], s [ 3 ][ 3 ], i , j ; printf ( "Enter the values of ...
  • C program for Unit Conversion
    /* Convert Celsius to Fahrenheit */ #include<stdio.h> void main() {     float c,f;     printf("Enter the temperature in Celcius: ...
  • Addition of two numbers on Server sent from Client [TCP] using C
    /* tcpClient.c */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #inc...
  • Write a Program to Print the Truth Table of Basic Gates using C
  • Write a Program to Add two 5x5 Matrix using C
    #include<stdio.h> void main() {   int a[5][5],b[5][5],c[5][5];   int i,j;   for(i=0;i<5;i++)   {     printf("\nEnter elements ...
  • Using the concept of Inheritance write a C++ Program to calculate the area and perimeter of rectangle
    /* C++ Program to calculate the area and perimeter of rectangles using concept of inheritance. */ #include using namespace std; class Re...
  • Concatenation of two strings sent from Client on the Server - [ TCP ] using C
    /* tcpClient.c */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #inc...
  • 8085 Programming: Exchange the contents of memory locations
    Exchange the contents of memory locations 2000H and 4000H. Program 1: LDA 2000H : Get the contents of memory location 2000H into accumulator...
  • Calculate Depreciation using C
    #include<conio.h> #include<stdio.h> void main () { float sv , pv , dep ; int yos ; clrscr (); printf ( "Enter the pu...
  • 8085 Programming: 1's COMPLEMENT OF A 16-BIT NUMBER
    The 16bit number is stored in C050,C051 The answer is stored in C052,C053   LXI H,C050   MOV A,M   CMA   STA C052   INX H   MOV ...

Blog Archive

  • ►  2020 (1)
    • ►  May (1)
  • ►  2015 (92)
    • ►  October (4)
    • ►  September (3)
    • ►  August (3)
    • ►  July (9)
    • ►  June (9)
    • ►  May (20)
    • ►  April (7)
    • ►  March (22)
    • ►  February (7)
    • ►  January (8)
  • ▼  2014 (158)
    • ►  November (70)
    • ►  October (6)
    • ▼  September (82)
      • Mahalaya
      • HokKolorob
      • C Program to Implement Heap Sort
      • Write a C Program to find the number of data in a ...
      • Write a Program in C++ to find the Factorial of a ...
      • Calculate Depreciation using C
      • Decimal to Octal Conversion using C
      • Decimal to Hexadecimal Conversion
      • Decimal to Binary Conversion
      • Write a C Program to compare two strings
      • CockTail Sort
      • Find the Roots of a Quadratic Equation
      • Alphabetical Sort Using C
      • Gauss-Jacobi Method using C
      • Gauss-Seidal Method using C
      • Newtons forward formula Using C
      • Newtons backward formula using C
      • Lagranges formula using C
      • Runga-Kutta Method using C
      • C Program to solve using Euler Rule
      • C Program to implement Simpson's 1/3 rd Rule
      • C Program to implement Trapezoidal Rule
      • Implement Secant Method using C
      • Method of Regula-Falsi using C
      • Implement Newton-Raphson Method using C
      • Implement Method of Bisection using C
      • C Program to Remove Duplicate Entries
      • Write a C Program to sort a set of number using Se...
      • Write a C Program to sort a set of elements using ...
      • Write a Program to Add two 5x5 Matrix using C
      • Write a C program to find the Transpose of a Matrix
      • Write a C Program to Multiply Two Matrix
      • Write a C Program to Implement Towers of Hanoi
      • Write a C Program to find the Length of a String
      • Write a C Program to change all alphabets to UPPER...
      • C Program to change all alphabets to lower case
      • Write a C Program to toggle case in a string
      • Write a program to Clear the screen without clrscr()
      • Write a C Program for Binary Search
      • Write a C Program for Linear Search
      • Write a C Program to find the Least from a set of ...
      • Write a C Program to find the Greatest from a set ...
      • Write a C Program to fine the Compound Interest
      • Program with Pointer
      • Flying Kite
      • Write a C Program to Implement Dijkstra's algorithm
      • Write a C program to Implement Merge Sort
      • Write a C Program to Implement Quick Sort Algorithm
      • Write a C Program to Calculate to the Power
      • Write a C Program to Check a number is Armstrong o...
      • C Program to Generate Fibonacci Series
      • Write a C Program to Check Weather a number is Pri...
      • Write a C Program to check a number is Palindrome ...
      • Write a C Program to find the Reverse of a Number
      • Write a C Program to Find the Sum of The Digits of...
      • Write a C Program to find the Factorial of a number
      • Write a C Program using For Loop
      • Write a C Program using While Loop
      • Write a Program to Check weather a number is Odd o...
      • Write a C Program to check Weather a Year is Leap ...
      • Write a C Program to find the Greatest number
      • Write a C Program to Swap the values of two variables
      • C program for Unit Conversion
      • Write a C Program to find Simple Interest
      • Find the Sum of two numbers using C
      • Write a simple C Program To Print a the given Pattern
      • Write a Program in C to find the Area Of a Circle
      • Write a C Program for Text File Handling
      • Write a C Program to create a Record Entry System
      • Write a C Program to Divide a Number by the Second...
      • Write a Program in C to Sort a Set of Number using...
      • Write a C Program to find the Sum of Square Terms ...
      • C Program to generate Multiplication Table
      • Write a Program in C to find the Sum of Fibonacci ...
      • Write a Program in C to evaluate raised to the power
      • Write a Program in C using if Statement
      • C Program to Sort numbers using different Sorting ...
      • Write a Program to Add two 3x3 Matrix using C
      • C - Programming
      • Write a Program in C to Display Hello, World !
      • Write a Program to Print the Truth Table of Basic ...
      • It's my First Blog Post !!
Powered by Blogger.

Categories

C - Programming Java Programming Basic Technology 8085 Assembly Programming For Loop Numerical Methods WhatsApp Algorithm Shell Programming Programming Networking Windows Android C++ Programming CPP If Else Tricky Internet Microsoft Pattern Photography Socket Program News While Loop Array DBMS DS Macro Recursion User Defined Function Conditional Operator Data Structure Durga Puja Earthquake Google Mela Nokia SQL Share Yahoo Airtel Bio Command Prompt Confused Facebook Finance Firefox Ganges Graph HokKolorob Input Kolkata MCQ Math Matrix NetNeutrality Oracle Religion Search Sumit Kar Survey Switch Case Viral Virus Visual Studio do-while featured featured_slider

Popular Programs

  • Write a Program to Add two 3x3 Matrix using C
    #include<stdio.h> void main () { int a [ 3 ][ 3 ], b [ 3 ][ 3 ], s [ 3 ][ 3 ], i , j ; printf ( "Enter the values of ...
  • C program for Unit Conversion
    /* Convert Celsius to Fahrenheit */ #include<stdio.h> void main() {     float c,f;     printf("Enter the temperature in Celcius: ...
  • Addition of two numbers on Server sent from Client [TCP] using C
    /* tcpClient.c */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #inc...
  • Write a Program to Print the Truth Table of Basic Gates using C
  • Write a Program to Add two 5x5 Matrix using C
    #include<stdio.h> void main() {   int a[5][5],b[5][5],c[5][5];   int i,j;   for(i=0;i<5;i++)   {     printf("\nEnter elements ...
  • Using the concept of Inheritance write a C++ Program to calculate the area and perimeter of rectangle
    /* C++ Program to calculate the area and perimeter of rectangles using concept of inheritance. */ #include using namespace std; class Re...
  • Concatenation of two strings sent from Client on the Server - [ TCP ] using C
    /* tcpClient.c */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #inc...
  • 8085 Programming: Exchange the contents of memory locations
    Exchange the contents of memory locations 2000H and 4000H. Program 1: LDA 2000H : Get the contents of memory location 2000H into accumulator...
  • Calculate Depreciation using C
    #include<conio.h> #include<stdio.h> void main () { float sv , pv , dep ; int yos ; clrscr (); printf ( "Enter the pu...
  • 8085 Programming: 1's COMPLEMENT OF A 16-BIT NUMBER
    The 16bit number is stored in C050,C051 The answer is stored in C052,C053   LXI H,C050   MOV A,M   CMA   STA C052   INX H   MOV ...

Daily Hits

Copyright © Sumit Kar