0% found this document useful (0 votes)
10 views4 pages

CDS Mid Sem Assignment

Class notes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

CDS Mid Sem Assignment

Class notes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Exercises

1. Write a program to print all natural numbers from 1 to n using loop.


2. Write a C program to print all alphabets from a to z. - using while loop
3. Write a C program to print all odd number between 1 to 100.
4. Write a C program to count number of digits in a number.
5. Write a C program to calculate sum of digits of a number.
6. Write a C program to find power of a number using for loop.
7. Write a C program to check whether a number is Prime number or not.
8. Write a C program to check whether a number is Armstrong number or
not.
9. Write a C program to print Pascal triangle up to n rows.
10. Write programs for the following patterns:
1 1
1 *
22 2 3
12 **
333 4 5 6
123 ***
4444 7 8 9 10
1234 ****
5555 11 12 13 14
12345 *****
15
*
* *
* * *
* * * *

#include<stdio.h>
void main()
{
int i,j;
for(i=1;i<=4;i++)
{
for(j=1;j<=i;j++)

}
}
Exercise
1. WAP to input the 3 sides of a triangle & print its corresponding type.
2. WAP to input the name of salesman & total sales made by him. Calculate &
print the commission earned.
TOTAL SALES RATE OF COMMISSION
1-1000 3%
1001-4000 8%
6001-6000 12 %
6001 and above 15 %
3. WAP to print the following series
i. S = 1 + 1/2 + 1/3 ……..1/10
ii. P= (1*2) + (2 *3) + (3* 4)+…….(8 *9) +(9 *10)
iii. S = x + x2 + x3 + x4......+ x9 + x10
iv. S = 1/1! + 1/2! + 1/3! ……………+1/n!
v. S = 1 + x + x2/2 + x3/3…….+xn/n
4. Write a C program to print Fibonacci series up to n terms.
5. Write a C program to find frequency of each digit in a given integer.

You might also like