Anda di halaman 1dari 2

Assignment

Q.1 Write a program to convert hexadecimal to decimal numbers. Enter the numbers such
as 0x1c, 0x18, 0xbc, 0xcd.
Q.2 Write a program to enter two numbers. Make a comparison between them with a
conditional operator. If the first number is greater than the second perform multiplication
otherwise perform division operation.
Q.3 Write a program to calculate the total cost of the vehicle by adding basic cost with (i)
excise duty (15%); (ii) sales tax (10%); (iii) octroi (5%) and (iv) road tax (1%). Input the
basic cost.
Q.4 Write a program to enter a four-digit number. Display the digits of the number in the
reverse order using modular division and division operation. Perform addition and
multiplication of digits.
Q.5 Write a program to store and interchange two float numbers in variables a and b.
Q.6 Write a program to ensure that the subtraction of any two-digit number and its reverse
is always the multiple of nine. For example, entered number is 54 and its reverse is 45.
The difference between them is 9.
Q.7 Write a program to check whether the blood donor is eligible or not for donating blood.
The conditions laid down are as under. Use if statements As follows:
(a) Age should be greater than 18 years but not more than 55 years.
(b) Weight should be more than 45 kg.
Q.8 Write a program to calculate bill of a job work done as follows. Use if-else
statement.
(a) Rate of typing Rs. 3/page.
(b) Printing of 1st copy Rs. 5/page and later every copy Rs. 3/page.
User should enter the number of pages and print out copies he/she wants.
Q.9 Write a program to calculate bill of Internet browsing. The conditions are given below.
(a) 1 Hour 20 Rs.
(b) Hour 10 Rs.
(c) Hours 90 Rs.
Owner should enter number of hours spent by customer
Q.10 Write a program to enter a character through keyboard. Use switch() case structure
and print appropriate message. Recognize the entered character whether it is vowel,
Consonants, or symbol
Q.11 Write a program to calculate the sum of first and last numbers from 1 to 10. (Example
1+10, 2+9, 3+8 sums should be always 11.)
Q.12 Write a program to pass the resolution in a meeting comprising of five members. If
three or more votes are obtained the resolution is passed otherwise rejected.
Q.13 Print multiplication of digits of any number. For example number 235, multiplication
to be 5*3*2 = 30. Use loop.

Q.14 Write a program to read a positive integer number n and generate the numbers in the
following way. If entered number is 3 the output will be as follows.
(a) 9 4 1 0 1 4 9
(b) 9 4 1 0 1 2 3
Hint use #include<math.h> library.
d=pow(i,2); to find square of i.

Write a program to read a positive integer number n and perform the squares of
individual digits.
For example n=325 then the output will be 9 4 25.
Q.15

Q.16 main()

{
int i=3;
switch(i)
{
default:printf("zero");
case 1: printf("one");
break;
case 2:printf("two");
break;
case 3: printf("three");
break;
}
} Output?
Q.17 main()
{
float me = 1.1;
double you = 1.1;
if(me==you)
printf("I love U");
else
printf("I hate U");
} Output?

Anda mungkin juga menyukai