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

02 Operators

The document outlines 15 programming problems related to basic operations, mathematical calculations, and data type conversions. Each problem includes a brief description, difficulty level, sample inputs, and expected outputs. The problems range from simple arithmetic to evaluating equations and determining data types and sizes.

Uploaded by

tahsinmahin2222
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

02 Operators

The document outlines 15 programming problems related to basic operations, mathematical calculations, and data type conversions. Each problem includes a brief description, difficulty level, sample inputs, and expected outputs. The problems range from simple arithmetic to evaluating equations and determining data types and sizes.

Uploaded by

tahsinmahin2222
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Operator Related Problems

(Total 15 questions)
SL Problem statement Difficulty
levels
1. Program that will take two numbers X and Y as inputs, then calculate and print the values *
of their addition, subtraction, multiplication, division (quotient and reminder).

Sample input (X,Y) Sample output


5 10 Addition: 15 -14 % 3 = -2
Subtraction: -5
-14 % -3 = -2
Multiplication: 50
Quotient : 0 14 % -3 = 2
Reminder: 5
-5 10.5 Addition: 5.5
Subtraction: -15.5
Multiplication: -52.5
Quotient: 0
Reminder: -48

2. Program that will calculate the circumference of a circle having radius r. *


Area, A = 2 * Pi * r

Sample input (r) Sample output


5 Area: 31.4
10.5 Area: 65.94

3. Program that will take two numbers (a, b) as inputs and compute the value of the equation *
– (Without using math.h)

X = (3.31 * a2 + 2.01 * b3) / (7.16 * b2 + 2.01 * a3)

Sample input (a, b) Sample output


5 10.5 X = 2.315475
100 -250 X = -12.766287
4. Program that will increment and decrement a number X by 1 inside the printf function. **
(Use ++ and - - operators)

Sample input(X) Sample output


5 X++ : 5
++X : 6
X- - : 5
--X : 4
-5 X++ : -5
++X : -4
X- - : -5
--X : -6

5. Program that will increment and decrement a number X by Y. (Use += and -= operators) *

Sample input(X,Y) Sample output


5 10 Incremented Value: 10
Decremented Value: -5
-5 5 Incremented Value: 0
Decremented Value: -10

6. Program that will multiply and divide a number X by Y. (Use *= and /= operators) *

Sample input(X,Y) Sample output


56 10 Multiplication: 560
Division: 5
-56 -10 Multiplication: 560
Division: 5

7. Program that will declare and initialize an integer and a floating point number. Then it will **
perform floating to integer and integer to floating conversions using
(a) Assignment operation
(b) Type casting

Sample input Sample output


-150 123.125 Assignment: 123.125000 assigned to an int produces 123
Assignment: -150 assigned to a float produces -150.000000
Type Casting: (float) -150 produces -150.000000
Type Casting: (int) 123.125 produces -123
8. Program that will take two numbers as inputs and print the maximum value. (Using **
conditional operator - ?)

Sample input (x, y) Sample output


20 100 Max: 100
50 -20 Max: 50

9. Program that will evaluate the following equations - *


X=a–b/3+c*2–1
Y = a – ( b / ( 3 + c ) * 2) - 1
Z = a – ( ( b / 3) + c * 2) - 1

Sample input (a, b, c) Sample output


9 12 3 X = 10
Y=4
Z = -1

10. Program that will take a, b & c as inputs and decide if the statements are True (1) of False **
(0)

a) ( )
b) ( )
c)

Sample input (a, b, c) Sample output


10 -10 0 a) 1
b) 0
c) 1

11. Program that will take a, b & c as inputs and decide if the statements are True (1) of False ***
(0)

1) ( )
2) ( )
3) ( )

Sample input (a, b, c) Sample output


10 -10 0 1) 0
2) 1
3) 1
12. Program that will take calculate the roots of a quadratic equation (a.x2 + b.x + c = 0) from ***
the formula, (here, dot (.) stands for multiplication) -

( )

Sample input (a, b, c) Sample output


2 4 -16 2.00 -4.00
1 2 3 Imaginary

13. Program that will evaluate the equation ***


; where 1<= x <=180 [No checking needed]

Sample input (x) Sample output


30 1.810066
120 0.778151
180 3.954243

Program that will take a floating point number X as input and evaluate A,B,C where- **
14. A = Value when X is rounded up to the nearest integer
B = Value when X is rounded down to the nearest integer
C = Absolute value of X

Sample input(X) Sample output


10.6 A = 11, B = 10, C = 10.6
-77.9 A = 78, B = 77, C = 77.9

15. Program to find size of int, float, double and char of the system. **

Sample input Sample output


Size of int in byte(s) = 4
Size of float in byte(s) = 4
Size of double in byte(s) = 8
Size of char in byte(s) = 1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy