IMG_20191115_210359[1].jpg - ebnath Questions[Total Marks 10x10 = 100 points 1 A positive integer is called a perfect number if it is equal to the sum

# IMG_20191115_210359[1].jpg - ebnath Questions[Total Marks...

• 1

This preview shows page 1 out of 1 page.

Unformatted text preview: ebnath Questions: [Total Marks: 10x10 = 100 points] 1. A positive integer is called a perfect number if it is equal to the sum of all of its divisors. excluding itself. For example, 6 and 28 are the two examples of perfect number, as 6 = 3+ 2 + 1 and 28 = 14 + 7+4 + 2 + 1 Now write a C program that will take a number as user input and check whether the number is perfect or not. Sample Input Sample Output Enter n: 6 6 is a perfect number! Enter n: 28 28 is a perfect number! Enter n: 32 32 is not a perfect number! 2. Write down a C program that will compute x&quot; where x and n are integers. Both x and n will be input to your program and they can be either positive or negative. Sample Input Sample Output Enter x: 5 Result: 125.000 Enter n: 3 Enter x: 5 Result: 0.008 Enter n: -3 Enter x: -5 Enter n: 3 Result: -125.000 Enter x: -5 Enter n: -3 Result: -0.008 3. Write a C program which will take n as user input and display the number pyramid of base size (2n-1) as shown in the sample output. Sample Input Sample Output Enter n: 5 1 12 3 12345 1234567 1 2 3 4 5 6 7 8 9 4. Write a C program which will take n as user input and display the alphabet pyramid of base size (2n-1) as shown in the sample output. Sample Input Sample Output Enter n: 5 A A B C ABCDE ABCDEFG ABCDEFGHI 5. A palindromic number is a number that is the same when written forwards or backwards, i.e. 12321, 94049, 543345 etc. Now, write down a C program that will take a number as user input and check whether the number is palindrome or not, using a user-defined function int isPalindrome(int n). Function isPalinrome will return 1 if the number is a palindrome, otherwise return 0....
View Full Document

• Fall '11

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern