Tech Unleashed

Wohoo!! We're on YouTube

Saturday, 15 January 2022

C program for " Temperature of a city in fahrenhiet degrees in input through the keyboard. write a program to convert this temperature into centigrade degrees. "

Problem: C program for " Temperature of a city in fahrenheit degrees in input through the keyboard. write a program to convert this temperature into centigrade degrees." 

Formula used: Celsius = (( farhenheit - 32 ) * 5 ) / 9

C program:

// Program by Shyam Kanth

#include<stdio.h>

int main(){
    float f, c;
    printf("Enter the temperature into fahrenhiet : ");
    scanf("%f",&f);
    c = ((f-32)*5)/9;
    printf("The temperatue in centigrade is %.2f degree.",c);
    return 0;
}

Codes used: 
  • #include < stdio.h> : Header file for input output
  • int : Integer data type
  • f,c : Variable used
  • printf : Function for displaying message
  • scanf : Function for taking input
  • formula : c = ((f-32)*5)/9
Do comment, if any doubt
Know about me : Shyam Kanth

No comments:

Post a Comment