Académique Documents
Professionnel Documents
Culture Documents
1. Experiment no. 2 Page no. 7 Topic 3.0 NEW CONCEPTS: Line no. 13
%d: For printing integer values-
Correction: %d: For printing Decimal integer values.
5. Experiment no. 3 Page no. 14 Topic 6.0 EXERCISES B.1. Line no. 6.
This line is conflicting. It should be meaningful, such as,
if (i==5 && z>50)
CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)
-1-
Errors in CPR (9017) manual
Program code:
‘case’ keyword is written as ‘Case’. It must whole be in small case.
For case 4, i.e. division, the output is in the form of integer. We can
introduce type casting or type conversion here by converting ‘result’ variable into float
data type. Change the line,
result = a/b; into result = float(a/b);
CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)
-2-
Errors in CPR (9017) manual
Here, value of max should be assigned with arr[i+1] not with arr[i]. If we
enter negative numbers, output doesn’t come accurate, so we can prefer one more
logic, i.e.
max = arr[0];
for(i=0; i<5; i++)
{
if(arr[i] > arr[i+1])
max = arr[i];
}
CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)
-3-
Errors in CPR (9017) manual
CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)
-4-
Errors in CPR (9017) manual
CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)
-5-
Errors in CPR (9017) manual
51. Algorithm writing and flowchart drawing method is also seems to be wrong in all
of the cases. In an algorithm, ‘start-stop’ and ‘begin-end’ are the pairs for the
first and last statement.
e.g.
1. Experiment no. 2 Page no. 8 Topic no. 5.0 Sample Program:
Problem Statement:
Write a program to calculate area of the circle.
Algorithm:
1. Start.
2. Input radius in cm.
3. Calculate, area = 3.14 * (radius * radius)
4. Display area.
5. Stop.
Flowchart:
CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)
-6-
Errors in CPR (9017) manual
Start
Input radius in
cm.
Calculate area =
3.14 * (radius * radius)
Display Area
Stop
Flowchart:
CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)
-7-
Errors in CPR (9017) manual
Start
Calculate, per =
(m1+m2+m3+m4+m5) / 5
Yes
Display
per >=75 “Distinction”
No
Yes
Display
per >=60 “First Class”
No
Yes
Display
per >=50 “Second Class”
No
Yes
Display
per >=40 “Pass Class”
No
Display
“Fail”
Stop
Function Call
Problem Statement:
Write a function for calculating factorial of a given number.
Algorithm:
1. Start.
2. Accept the number n from user.
3. Call the function fact(int n) for calculating factorial.
CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)
-8-
Errors in CPR (9017) manual
Flowchart:
fact = fact * i;
Call the function
factorial = fact (n)
Increment i by 1
No
Stop Return fact
Algorithm:
1. Start.
2. Input values of two variables i.e. ‘a’ and ‘b’.
3. Call function swap () and pass addresses of these variables to this
function to swap the values.
4. Display the values of ‘a’ and ‘b’.
5. Stop.
CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)
-9-
Errors in CPR (9017) manual
Flowchart:
Start
Call function
swap(int *, int *) Copy content of y in
content of x
Return
Stop
CPR (FYIF) by Mr. Kute T. B. (Lecturer in IT, KK Wagh Polytechnic, Nashik 2007-2008)
- 10 -