answersLogoWhite

0


Best Answer

You would write an algorithm using the switch statement in C in the same manner as one would write an algorithm using any other statement. The tools supported by a particular programming language, such as conditional expressions and iteration constructs, are normally used together to implement an algorithm.

However, one particular group of algorithms lends itself to the use of the switch statement as the primary construct in the algorithm's implementation, although all other language constructs will generally be used in the same implementation: state machines are a method of solving a certain group of problems through a series of states and conditional transitions from one state into another.

A simple state machine could, for example, use a switch clause as its primary construct, where each case clause represents one of the possible states. In each state, the condition is checked which might enable the transition to another state. When that condition evaluates to true, the transitional action is taken and the new state is assumed.

In its simplest form, a state machine is formed from an endless loop surrounding a switch statement.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can we write a Algorithm using switch case in C language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do you RSA algorithm c?

Perform encryption on the following PT using RSA and find the CT p = 3; q = 11; M = 5


What are the ways representing an algorithm?

You can represent an algorithm by three different ways: 1. Pseudo Code 2. Structured flow charts 3. Actual code


What is algorithm to write algorithm to the program to access a pointer variable in structure?

Here is the algorithm of the algorithm to write an algorithm to access a pointer in a variable. Algorithmically.name_of_the_structure dot name_of_the _field,eg:mystruct.pointerfield


How to write algorithm in c program?

Algorithms are created using pseudocode, which is a combination of natural language (such as English) and commonly understood programming concepts. Pseudocode is a machine-independent language, but it is far too abstract for a machine to understand. It is intended for humans only. As programmers, our job is to translate these algorithms into a form the machine can process in order to produce the required machine-dependent code. For this we use programming languages, such as C, C++ and Java. The more abstract the programming language, the easier it is to convert an algorithm into working code. Of all the high-level programming languages, C has the least amount of abstraction, however we can make use of third party libraries to increase the amount of abstraction, or we can use the language itself to create our own abstractions.


A Write the algorithm to concatenate two given strings?

a write the algorithm to concatenate two given string

Related questions

How do you write an Algorithm for a C plus plus Program?

You don't write an algorithm for a C++ program, unless you are documenting the C++ program after-the-fact. The normal procedure is to write the algorithm first, in a language independent fashion, and then translate that stated algorithm into C++ code, or into whatever language you wish.


What is algorithm write properties of algorithm?

An ALGORITHM is a sequence of steps that depicts the program logic independent of the language in which it is to be implemented. An algorithm should be designed with space and time complexities in mind.


How do you RSA algorithm c?

Perform encryption on the following PT using RSA and find the CT p = 3; q = 11; M = 5


What is algorithams?

Algarithm: Algorithm is process to solve the problem in a step by step order Algorithm is used to write the program in a computer language. thrinath.sachin@gmail.com


Can you write an algorithm to find the greatest of three number using class?

Yes. But why?


What are the ways representing an algorithm?

You can represent an algorithm by three different ways: 1. Pseudo Code 2. Structured flow charts 3. Actual code


Are languages and compilers application softwares?

No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.No. A compiler is a system software. An application can be created using a language and a compiler. A language is what you write the software with.


What is algorithm to write algorithm to the program to access a pointer variable in structure?

Here is the algorithm of the algorithm to write an algorithm to access a pointer in a variable. Algorithmically.name_of_the_structure dot name_of_the _field,eg:mystruct.pointerfield


Write an algorithm to find the root of quadratic equation?

Write an algorithm to find the root of quadratic equation


How do you write algorith of C programs?

There is no specific Hard and Fast rule for writing algorithm. The normal method is the following: 1. get a problem 2. find or invent an algorithm to solve it 3. implement the algorithm in a programming language (C, for example)


How to write algorithm in c program?

Algorithms are created using pseudocode, which is a combination of natural language (such as English) and commonly understood programming concepts. Pseudocode is a machine-independent language, but it is far too abstract for a machine to understand. It is intended for humans only. As programmers, our job is to translate these algorithms into a form the machine can process in order to produce the required machine-dependent code. For this we use programming languages, such as C, C++ and Java. The more abstract the programming language, the easier it is to convert an algorithm into working code. Of all the high-level programming languages, C has the least amount of abstraction, however we can make use of third party libraries to increase the amount of abstraction, or we can use the language itself to create our own abstractions.


How do you write algorithm for java program?

An "algorithm" is a method to solve a problem. These methods are more or less independent of the language. First you think about how you will solve a certain problem, step by step. Then you translate this into a computer program.