subroutines.c सम्पादन

// This program asks the user for a Fahrenheit temperature,
// converts the given temperature to Celsius,
// and displays the results.

#include "stdio.h"

float get_f();
float calculate_c(float f);
void display_result(float f, float c);

int main(void)
{
    float f;
    float c;
    
    f = get_f();
    c = calculate_c(f);
    display_result(f, c);

    return 0;
}

float get_f()
{
    float f;
    
    printf("Enter Fahrenheit temperature:");
    scanf("%f", &f);

    return f;
}

float calculate_c(float f)
{
    float c;
    
    c = (f - 32) * 5 / 9;
    
    return c;
}

void display_result(float f, float c)
{
    printf("%f° Fahrenheit is %f° Celsius", f, c);
}

कोशिश करो सम्पादन

निम्न कोड मुफ्त ऑनलाइन विकास के वातावरण में से एक में ऊपर कॉपी और पेस्ट करो या अपने खुद के कम्पाइलर/इंटरप्रेटर/आईडीई का उपयोग करें।

यह भी देखें सम्पादन