#Don't understand the problem here.

10 messages · Page 1 of 1 (latest)

snow wyvern
#

So here's the code

#include<stdio.h>

int main()
{
    int choice;
    float f,c;
    
    printf("Enter the option no.\n");
    printf("1.Fahrenheit to Celcius\n");
    printf("2.Celcius to Fahrenheit\n");
    
    printf("choice : ");
    scanf("%d",choice);
    
    switch(choice)
        {
            
        case 1 : 
            {
            printf("Enter the temperature in °F : ");
            scanf("%f",f);
            
            c=(f-32)*5/9;
            
            printf("The temperature in °C is %f",c);
            
            break;
            }
            
        case 2 : 
            {
            printf("Enter the temperature in °C : ");
            scanf("%f",c);
            
            f=9/5*c+32;
            
            printf("The temperature in °F is %f",f);
            
            break;
            }
            
        default : 
            {
            printf("Invalid option.\n");
            }
            
        }
        
    printf("Program ended\n");
    return 0;
}

And this is the output

proot info: vpid 1: terminated with signal 11
hybrid oliveBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

tribal crown
#

You have to pass a pointer to the variable in scanf

#

scanf("%d", &choice);

#

Also, you spelt "Celcius" wrong

#

Celsius

snow wyvern
#

! solved

#

!solved