MANIPAL INTERNATIONAL UNIVERSITY
SCHOOL OF SCIENCE AND ENGINEERING
I SEM B.E
COMPUTER PROGRAMMING-ASSIGNMENT
1. Accept the salary of an employee from the user. Calculate the gross salary on the
following basis:
Basic HRA DA .
1 - 4000 10% 50%
4001 - 8000 20% 60%
8001 - 12000 25% 70%
12000 and above 30% 80%
2. Write a C program to find the sum of individual digits in a number
3. Accept any number from the user. Display whether the number is divisible by 100
or not.
4. For each of the following, ff the values of a=5, b=6 and c=4, find the value of
i. R= -a++ + c;
ii. R=a+b+c++;
iii. R= a*b/++c;
5. Write a C program to display all prime numbers between 5 and 150
6. Write a program to accept 10 values in an integer array. Display the total number of odd,
even, and negative numbers.
7. Create a structure to store the employee number, name, department and basic
salary. Create a array of structure to accept and display the values of 10
employees.
8. Write a C program to read two sorted arrays and to merge them into a single sorted array.
9. What does this program print in C?
#include <stdio.h>
struct integer {
int val;
};
static void bar(struct integer i) {
i.val = 5;
}
main(int argc, char *argv[]) {
struct integer n;
n.val = 1;
bar(n);
printf("%d\n", n.val);
}
10. Write a C program to check whether the year is leap year or not.(hint: use modulus %
operator)