Loops – Arithmetic – Problem #10

IIT Kharagpur CS10001 / CS11001 Programming and Data Structures Lab Question Archive

Difficulty: Hard

Problem Statement

Part-I A positive integer is called an IIT number if the number is equal to the sum of factorial of its digits. For example, 1 (1 = 1!), 2 (2 = 2!), 145 (145 = 1! + 4! + 5!) are IIT numbers. Write a C program to perform the following tasks. 1. To check if a given positive number x is an IIT number. 2. To print all IIT numbers from 1 to a given input number n. Part-II A positive integer is called a KGP number if the number is equal to the sum of its divisor except itself. For example, 6 (6 = 1 + 2 + 3), 28 = (1 + 2 + 4 + 7 + 14) are KGP numbers. Write a C program to perform the following tasks. 1. To check if a given positive number x is a KGP number. 2. To print all KGP numbers from 1 to a given input number n. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Table 1: Star K of height 9. Part-III Write a C program to perform the following tasks. 1. Take a positive integer n as input and output a K of height 2n - 1 stars. A star K of height 9 is the following. Submit one (single) C program. Sample Output palash@palash-ThinkPad-X1-Yoga-3rd:~$ ./a.out ./a.out Write number x: 145 145 is an IIT number Write number n: 1000 The IIT numbers between 1 and 1000: 1, 2, 145, Write number x: 28 28 is a KGP number Write number n: 1000 The KGP numbers between 1 and 1000: 6, 28, 496, Write a positive integer n: 2 Star K of height 3 is * * * * * palash@palash-ThinkPad-X1-Yoga-3rd:~$

Back to Lab Problems
Loops/Arithmetic/Problem #10

Lab Problem Statement

Specifications & Problem DetailsIIT Kharagpur PDS Archive
Loading question...

Interactive C Compiler · Problem #10

WASM In-Browser

Runs directly on your machine · Zero remote server dependency

Compiler downloads on first Run (large, saved in your browser after that)
main.cCtrl + Enter to run
1
2
3
4
5
6
7
Input (stdin)given to scanf / cin
Output

Output appears here. Press Run to compile and execute.