0% found this document useful (0 votes)
16 views

C Basic Assignment.

The document contains 10 programming questions involving the use of if-else statements and for loops to solve problems related to checking conditions, performing calculations, and logical operations. Some examples include: 1) A program to check if a number is positive or negative, and odd or even. 2) A program to check if a student passed or failed an exam and which grade they are in. 3) A program to calculate bonus eligibility for an employee based on their years of service. 4) A program to calculate an employee's gross salary based on their basic salary, HRA, and DA amounts.

Uploaded by

schoolhelpmentor
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

C Basic Assignment.

The document contains 10 programming questions involving the use of if-else statements and for loops to solve problems related to checking conditions, performing calculations, and logical operations. Some examples include: 1) A program to check if a number is positive or negative, and odd or even. 2) A program to check if a student passed or failed an exam and which grade they are in. 3) A program to calculate bonus eligibility for an employee based on their years of service. 4) A program to calculate an employee's gross salary based on their basic salary, HRA, and DA amounts.

Uploaded by

schoolhelpmentor
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Question : C Programing

Program using if else / for loop.

1. WAP to input number, and check if number is positive and if number


is odd or even.
2. WAP to check if a student passed or failed. Also if passed, which
grade student is in ?
3. The current year and the year in which the employee joined the
organization are entered through the keyboard. If the number of
years for which the employee has served the organization is greater
than 3, then a bonus of Rs. 2500/- is given to the employee. If the
years of service are not greater than 3, then the program should do
nothing. (yearsOfService = currentYear - joinYear)
4. In a company an employee is paid as under: If his basic salary is
less than Rs. 1500, then HRA = 10% of basic salary and DA = 90% of
basic salary. If his salary is either equal to or above Rs. 1500,
then HRA = Rs. 500 and DA = 98% of basic salary. If the employee’s
salary is input through the keyboard write a program to find his
gross salary. (gs = bs + hra + da).
5. If cost price and selling price of an item are input through the
keyboard, write a program to determine whether the seller has made
profit or incurred loss. Also determine how much profit he made or
loss he incurred.
6. While purchasing certain items, a discount of 10% is offered if the
quantity purchased is more than 1000. If quantity and price per item
are input through the keyboard, write a program to calculate the
total expenses. (Item and rate of items.)
7. WAP to take 3 input from user and check which number is smallest and
print the number.
8. What will be the output of the below code.
# include <stdio.h>

int main( )

int i = 4, z = 12 ;

if ( i = 5 || z > 50 )

printf ( "Dean of students affairs\n" ) ;

else

printf ( "Dosa\n" ) ;

return 0 ;

9. Output of mentioned code :


#include <stdio.h>
int main( )

int i = 4, j = -1, k = 0, w, x, y, z ;

w = i || j || k ;

x = i && j && k ;

y = i || j && k ;

z = i && j || k ;

printf ( "w = %d x = %d y = %d z = %d\n", w, x, y, z ) ;

return 0 ;

10. Any year is entered through the keyboard, write a program to


determine whether the year is leap or not. Use the logical operators
&& and ||.

You might also like