Design an algorithm and draw corresponding flowchart to find all the prime numbers between two given numbers ‘m’ and ‘n’, where m, n > 0. 10m Dec2005
An algorithm is a finite set of steps defining the solution of a particular problem. An algorithm is expressed in pseudo code – something resembling C language or Pascal, but with some statements in English rather than within the programming language
- A sequential solution of any program that written in human language, called algorithm.
- Algorithm is first step of the solution process, after the analysis of problem, programmers write the algorithm of that problem.
Pseudo code
- Input N and M
- While N is smaller than M
- Initialize I to 2
- While I is smaller than N
- If N is divisible by I
- skip loop
- Increment I
- If N is equal to I
- Print N
- Increment N
Detailed Algorithm:
Step 1: Input N & M
Step 2: While (N < M)
I=2
Step 4: While (I<N)
Step 5: IF N%I == 0
goto Step 7
Step 6: I++
Step 7: IF I==NUM
Print NUM
Step 7: N++
Flowchart:-
Design an algorithm and write a program using ‘C’ to compute transpose of a matrix. 10m Dec2005
Solved program can be found on this link http://cssimplified.com/c-programming/a-c-program-to-compute-transpose-of-a-matrix
Write a program to process the mark for 4 courses in a semester. Each course contains 2 components namely internal assessment and external examination. Students need to pass in both the components individually by acquiring at least 40% in order to declare successful completion in a course, Compute the total marks average and also display the Grade accordingly. 10m Dec2005 Note: You should use “Structures” concept
Few changes needed. MARK has to be divided into internal and external
Solved program can be found on this link http://cssimplified.com/c-programming/a-c-program-to-process-the-students-evolution-records-using-structures