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

C prog Solution Q1-Q22-yearly assignment

The document outlines a series of programming exercises in C, focusing on variable assignment, arithmetic operations, conditional statements, and user input. It includes tasks such as calculating area and circumference, converting temperatures, and determining the smallest number among three inputs. Each exercise aims to reinforce fundamental programming concepts and logic in C.

Uploaded by

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

C prog Solution Q1-Q22-yearly assignment

The document outlines a series of programming exercises in C, focusing on variable assignment, arithmetic operations, conditional statements, and user input. It includes tasks such as calculating area and circumference, converting temperatures, and determining the smallest number among three inputs. Each exercise aims to reinforce fundamental programming concepts and logic in C.

Uploaded by

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

Solution Q1:

a.

b)

c)
2. Write a C program to assign a values to two variables and display them.

3. Write a C program to assign values to variable num1 and num2


and evaluatefollowing expressions
a. (num1+num2/num1*num1)
b. (num1-num2/num1)-num1
c. num2/num2*num1+num1
d. num1-num2*num1*num2/num2

4. Write a C program to assign values to two variables A and B


and show theresult of addition, subtraction, multiplication
and division for the two numbers. Use proper printf()
statements.
5. Write a C program to assign a three digit number to a variable
and display each digit on different line.

6. Write a C program to assign a three digit number to a variable


and display itin reverse order with each digit on different line.

7. Write a C program to assign temperature in Farenheit (0F)and convert it


to Celsius(0C). Also assign temperature in Celsius (0C) and convert it to
Farenheit(0F). Use the following formulae for conversion

C=(f-32) * (5/9) , F=9/(5*C + 32)


8. Write a C program to assign values to a variable and display its
square and cube.

9. Write a C program to accept radius value from user and display


the Area andCircumference of the Circle.

10. Write a C program to accept length and breadth values from

the user anddisplay perimeter and Area of Rectangle.


11. Write a C program to accept values of variable x and y

and solve thefollowing equations.


a. X2+2XY+Y2
b. Y3+6X2

12. Mohan brought pens, packets of pencils and notebooks.

Accept input for pens, packets of pencils and notebooks in


three different variables. Assign cost for each and calculate the
stationary bill.
13. Accept two values in two variables and then swap the

values of thesevariables.

Write a C program to accept a numbers from user and display which number is
Positive, negative or neutral.
14.Write a C program to accept two numbers from user and display which
number is greater.
15.Write a C program to accept two numbers from user and display whether
they are equal or not.

16.Write a C program to accept a number and display whether it a odd or even


number.
17.Write a C program to accept two numbers and divide them. The division has
to take place only if divisor is non-zero number.

19.Write a C program to accept a number of month and display month.


20.Write a C program to accept a number and display whether it is a leap year
or not.

21.Write a C program to accept three numbers from the user and display
smallest number.
22.Write a C program to calculate and display discount on the amount based on
following
a) If amount is <100 No discount
b) If amount>100 and <=200 discount=15%
c) If amount>200 and <=300 discount=21%
d) If amount>300 discount=33%

You might also like