Practice Problem For Week 2 CSE 109
Practice Problem For Week 2 CSE 109
1. Write a program that takes as input an integer n and prints out the sum of
integers from 1 to n. Here, 1 ≤ ≤ 2 − 1.
int main(){
unsigned int i=10;
if(i>-1){
printf("Yes");
}
else printf("No");
}
4. Write a C program that takes a real number and prints the ceiling of that
number.
5. Write a C program that takes a real number and rounds the number and prints
the rounded value.
6. Write a C program that takes a real number and prints the ceiling of that number
up to n digits.
7. Assume that you are given 2 two-digit numbers. Read each of the digits as
characters and print out the summation of the two numbers.
8. Write a C program print total number of days in a month using switch case.
10.Write a C program that takes as input the date of birth of two persons and prints
weather the first person is older that the second one.
12.Write a C program that takes a year as input and prints whether it is leap year or
not.
13.Write a program to determine the grade based on an input number. The grades
chart is given below:
14. Write a program that takes two integers x and n and computes .
16. Write a program prints the results of the following series. Here, n is an input to
your program,
a. 1 + 2 + 3 + ⋯ +
b. + + + ⋯+
17. Write a program to print the following pyramids with “*” characters. Take the
number of rows n as input.
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
N=5 N=5
*
* *
* *
* *
* * * * * * * * *
N=5