Home Master of Computer Application Download MCS-011 Problem Solving and Programming solved assignment 2018-19

Download MCS-011 Problem Solving and Programming solved assignment 2018-19

3
18

MCS-011 Problem Solving and Programming Solved Assignment 2018-2019

Course Code : MCS-011
Course Title : Problem Solving and Programming
Assignment Number : MCA(2)/011/Assignment/2018-19
Maximum Marks : 100
Weightage : 25%
Last Date of Submission : 15th October, 2018 (for July, 2018 batch)
15th April, 2019(for January, 2019 batch)

Back

1. Question 1 : Write an algorithm, draw a flow chart and write its corresponding C program to convert a decimal number to its equivalent hexadecimal number. (10 Marks)
Answer-

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

  1. A sequential solution of any program that written in human language, called algorithm.
  2. Algorithm is first step of the solution process, after the analysis of problem, programmers write the algorithm of that problem.

Pseudo code 

  • Input Num
  • Initialize Len to zero and Y to Num
  • While Y is not zero
  •                Save Remainder by Y Mod 16 in array HEXD at index Len
  •                Initialize Y to Y divided 16
  •                Increment Len
  • for(Initialize I to Len-1 ; Condition I Greater than  -1 ;  Decrement I )
  •                If HEXD[I] Less than 10
  •                           HEXC[I]=HEXD[I]+48
  •                Else
  •                           HEXC[I]=HEXD[I]+55
  • Initialize HEXC[I] to NULL
  • Print HEXC

Detailed Algorithm:

Step 1:  Input NUM

Step 2:  LEN = 0 & Y=NUM

Step 3:  While (Y > 0)

HEXD[LEN]=Y%16

Y=Y/16

LEN++

Step 4: for(I=LEN-1;I>-1;I–)

IF(HEXD[I]<10)

HEXC[I]=HEXD[I]+48;

ELSE

HEXC[I]=HEXD[I]+55;

Step 5:  HEXC[I]=NULL

Step 5:  Print HEXC

 

Flowchart:-

 

Back

3 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here