FYBCS C Exercise_5

Set A . Write C programs for the following problems. 

 1. Write a program to display all prime numbers between ____ and ____.

 2. Write a program to display multiplication tables from ___ to ___ having n multiples each. The output should be displayed in a tabular format. For example, the multiplication tables of 2 to 9 having 10 multiples each is shown below.  
2 × 1 = 2     3 × 1 = 3 ………….9 × 1 = 9  
2 × 2 = 4     3 × 2 = 6…………..9 × 2 = 18
 …………. …………. ................................. 
2 × 10 = 20 3 × 10 = 30………..9 × 10 = 90  

 3. Modify the sample program 1 to display n lines as follows (here n=4).             
 A      B      C      D              
E      F      G              
H      I              


Set B. Write C programs for the following problems. 

 1. Write a program to display all Armstrong numbers between 1 and 500. (An Armstrong number is a number such that the sum of cube of digits = number itself Ex. 153 = 1*1*1 + 5*5*5+ 3*3*3 

 2. Accept n numbers and display the number having the maximum sum of digits

 3.Display all perfect numbers below 500[A perfect number is a number, such that the sum of its factors is equal to the number itself]. Example: 6 (1 + 2 + 3), 28 (1+2+4+7+14)  

Post a Comment

0 Comments