i created a code that converts the temperature into another form, like if you want to convert celcius to farenheit or kevlin and vice versa. But it isnt working as i thought.
code:-
#include <stdio.h>
int main()
{
  float a, b;
  char c, e;
  printf("What you want to change\ntype c for celcius, f for farenheit or k for kelvin: ");
  scanf("%c", &c);
  switch (c)
  {
  case 'c':
    printf("Now put the celcius value you want to convert: ");
    scanf("%f", &a);
    printf("Now in which you want to change\ntype f for farenheit or k for kelvin: ");
    scanf("%c", &e);
    switch (e)
    {
    case 'f':
      printf("The farenheit value of %0.2f degree celcius: %0.2f\n", a, a*1.8+32);
      break;
    case 'k':
      printf("The kelvin value of %0.2f degree celcius: %0.2f\n", a, a+273.15);
      break;       
    default:
      printf("You didnt put the correct operation");
      break;        
    }
    break;
  case 'f':
    printf("Now put the farenheit value you want to change into celcius: ");
    scanf("%f", &a);
    b = ((a-32)*5)/9;
    printf("Now in which you want to change\ntype c for celcius or k for kelvin: ");
    scanf("%c", &e);
    switch (e) {
  case 'c':
    printf("The celcius value of %0.2f degree farenheit: %.2f\n", a, b);
    break;
  case 'k':
    printf("The kelvin value of %0.2f degree farenheit: %0.2f\n", a, b+273.15);
    break;
  default:
    printf("You didnt put the correct operation");
    break;        
    }
    break;
  case 'k':
    printf("Now put the kelvin value you want to change: ");
    scanf("%f", &a);
    if (a>=0) {
      printf("Now in which you want to change\ntype c for celcius or f for farenheit: ");
      scanf("%c", &e);        
      b=(a-273.15)*1.8+32;
      switch (e) {
  case 'c':
    printf("The celcius value of %0.2f kelvin in celcius is: %0.2f\n", a, a-273.15);
    break;
  case 'f':
    printf("The farenheit value of %0.2f kelvin in farenheit is: %0.2f\n", a, b);
    break;
  default:
    printf("You didnt put the correct operation");
    break;                
      }}
    else {
      printf("Kelvin cannot be less than zero");
    }
    break;
  default:
    printf("You didnt put the correct spell of what you want to change\n");                
    break;
  }
  return 0;
}
I was trying to make it so that it will ask the user in which you want to change but it didnt worked as i thought. It isnt asking for what you want to change and skips that scanf function.
 
     
    