MIPI_BaseC_WebinarFRTK/18_Seminar05/00_switch_p1.c
2024-11-13 09:22:28 +03:00

31 lines
571 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <stdio.h>
int max(int a,int b)
{
return a>b ? a : b;
}
int main()
{
int a,b;
scanf ("%d%d", &a,&b);
switch (max(a,b))
{
case 2:
printf("case 2:\n");
a *= 2 ; // Если expr == 2, то выполнится a += 5; из следующей ветки
//~ break;
case 3:
a += 5;
break; // А здесь произойдет выход
case 4:
a -= b;
break;
default:
break;
}
printf("%d", a);
return 0; //Завершить программу успешно
}