You are on page 1of 3

Shanghai DianJi University

School Year:2021_–2022_ The _ 1 _ term


(033Z03A1)“Programming & Database & Algorithms Experiment”
Final exam paper
Curriculum Designing School:School of Electronic Information Engineering
The duration of the examination: 120 minutes Volume: A
Calculator □ Draft paper□
√ Answer card □
Form of examination: open-book □ /close-book□√
Name: Student Number: Class:

Title Order I II III IV


Score
Reviewer

Ⅰ. Programming A ( 30 marks)
Write a program to input an integer value no more than 4 digits, determine and tell the number of
digits.
Specification of output:
1 digit: one figure 2 digits: two figures
3 digits: three figures 4 digits: four figures
Invalid:Invalid number
【sample input】
356
【sample output】
three figures

II. Programming B (30 marks)


Narcissistic number is a number that is the sum of its own digits each raised to the power of the
number of digits. For example: 153 is a Narcissistic number, because 153=13+53+33
Write a program to find and print all the Narcissistic numbers between 100 and 999.

III. Programming C (30 marks)


1/3
Write a program too input an intteger numberr m and searcch m in the following
f maatrix. Print out the
positioon when m fiirst appears. Print out thee total times m appears.

IV. Prrogrammin
ng D(10 maarks)
Fill thee blank in thee program too finish the program
p and show the folllow
graphic.
【sampple graphic】

【proggram code】
#includde<stdio.h>
void drraw(int m,int n,char c);
int maiin(void)
{
int i;
<=7;++i)
for(i=1;i<
{
w(7-i,2*i-1,_______);
draw
}
>=1;--i)
for(i=6;i>
{
w(7-i,2*i-1,_______);
draw
}
return 0;
}

void drraw(______)
{
int j;
<m;++j)
for(j=0;j<
{
printtf(" ");
}

2/3
for(j=0;j<n;++j)
{
printf(______);
}
printf("\n");
}

3/3

You might also like