Computer Science, asked by sarkarsid, 9 months ago

Fill in with appropriate datatype.
switch(___)
{
case value1: ________
case value2:________
_________

default:

System.out.println("Hello");
}
select the appropriate data type from switch
a) long
b) float
3)Long
4)byte​

Answers

Answered by kamlesh678
1

Answer:

Check here for better understanding in switch case (C++)

Explanation:

switch (n)

{

   case 1: // code to be executed if n = 1;

       break;

   case 2: // code to be executed if n = 2;

       break;

   default: // code to be executed if n doesn't match any cases

}

-------------------------------------------------------------------------------------------------------------

// C++ program  to demonstrate syntax of switch

#include <iostream>

using namespace std;

// Driver Code

int main()

{

   int x = 2;

   switch (x) {

   case 1:

       cout << "Choice is 1";

       break;

   case 2:

       cout << "Choice is 2";

       break;

   case 3:

       cout << "Choice is 3";

       break;

   default:

       cout << "Choice other than 1, 2 and 3";

       break;

   }

   return 0;

}

---------------------------------------------------------------------------------------------------------

#SPJ3

Answered by syed2020ashaels
3

switch (n)

{

case 1: // code to be executed if n = 1;

   break;

case 2: // code to be executed if n = 2;

   break;

default: // code to be executed if n doesn't match any cases

}

// C++ program to demonstrate syntax of switch

#include <iostream>

using namespace std;

// Driver Code

int main()

{

  int x = 2;

  switch (x) {

  case 1:

      cout << "Choice is 1";

      break;

  case 2:

      cout << "Choice is 2";

      break;

  case 3:

      cout << "Choice is 3";

      break;

  default:

      cout << "Choice other than 1, 2 and 3";

      break;

  }

  return 0;

}

#SPJ2

Similar questions