Temperature Conversion C to F & F to C - C Program

Program:
#include<stdio.h>
//#include<conio.h>
void main()
{
    int d,e=248;float a,b,c;
    //clrscr();
    printf("\n\t\t***Temperature conversion program***\n");
    n:
    printf("\n\tWhat u want to do?\n\t\t1:Convert %cC to %cF\n\t\t2:convert %cF to %cC\n\t\t",e,e,e,e);
    scanf("%d",&d);
    if(d==1)
    {
        printf("Enter the temp in %cc\n",e);
        scanf("%f",&a);
        b=(1.8*a)+32;
        printf("The temperature in %cF is:%f",e,b);
    }
    else if(d==2)
    {
        printf("Enter the temperature in %cF:\n",e);
        scanf("%f",&a);
        b=((0.5555555555555556)*(a-32));
        printf("The temperature in %cC is:%f",e,b);
    }
    else
    {
        printf("\n\tWrong choice!\n\tenter either 1 or 2\n\n\n");
        goto n;
    }
    //getch();
}

Output:
nn@linuxmint ~ $ gcc cc1.c
nn@linuxmint ~ $ ./a.out

        ***Temperature conversion program***

    What u want to do?
        1:Convert �C to �F
        2:convert �F to �C
        1
Enter the temp in �c
100
The temperature in �F is:212.000000nn@linuxmint ~ $ ./a.out

        ***Temperature conversion program***

    What u want to do?
        1:Convert �C to �F
        2:convert �F to �C
        3

    Wrong choice!
    enter either 1 or 2



    What u want to do?
        1:Convert �C to �F
        2:convert �F to �C
        2
Enter the temperature in �F:
212
The temperature in �C is:100.000000
nn@linuxmint ~ $

1 comment:

  1. Elevate your web development skills with our Best Mern Stack Course In South Delhi , providing a thorough understanding of the MERN technology stack for comprehensive full-stack expertise.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...