Вы находитесь на странице: 1из 2

CS-110

Fundamentals of Computer
Programming

QUIZ 2

Course
Instructor:
Quratulain Shaf

Institute of
Geographical

Quiz # 2
1. Write a program that takes an integer as
input and displays if its a prime number or
not?
2.

Write a program that takes an a 3-digit


integer as input and displays whether the
number is an Armstrong number or not.
(If sum of cubes of each digit of the number is equal
to the number itself, then the number is called an
Armstrong
number.
For
example,
153
=
(1*1*1)+(5*5*5)+(3*3*3). Hint: separate the number
in digits first.)

2003 Prentice Hall, Inc. All rights reserved.

Вам также может понравиться