Você está na página 1de 7

APPENDIX B

,C' PROGRAMMING
l.

PRACTICE

Write a program to calculate the 4ft power of first 25 odd natural nos.

2. Write a program that will continue to find area of circle for user input radius.
3. Write a program to add first seven terms of the following series
4.

ll22 + 2132 + 3142 +


Write a temperature conversion program that gives the user the option of converting
Fahrenheit to Celsius or Celsius to Fahrenheit.
Interaction with program may look like
Type

to convert Fahrenheit to Celsius

Type 2 to convert Celsius to Fahrenheit


Type 3 to exit

If I

Enter temp. in Fahrenheit

Then in Celsius that is

i
i
I
',
i
I

5.

---

Write a program that will continue to find amount accumulated under compound interest
tcheme for user input principal amount, interest rate & number of years till user gives 0
value of principal amount.

6. Write

a switch statement that

will examine the value of an integer variable called flag and

print one of the following messages depending on the value assigned of flag.
HOT if flag has value I
WARM if flag has value 2

COLD if flag has value 3


OUT OF RANGE if flag has any other value

't
I

7. Write switch

statement that will examine the value of char type variable called color and
print one of the foliowing messages
(II) RED if either 'r' or 'R' is assigned to color
(lII) GREEN if either 'g' or 'G' is assigned to color
(IV) BLUE if either 'b' or 'B' is assigned to color
(V) BLACK by default
A. Write a program that will generate every third integer beginning with 2 continuing upto
100. Calculate the sum of these integers which are only divisible by 5.
9. Write a C program to determine user input number is prime or not.
10. Write a program to decide whether the input number is odd or even.
ll. Write a program that user function cirperi ( ) to calculate circumference of a circle. It
should take argument of type float and returns an argument of same type.
12. Write a program which uses a function power ( ) to raise a number to power p.
13. A phone number can be thoq-ght of as having two members std code and phone no. Write
a program uslng strucrure whose members are std code and phone no. Initialize your own

204

Apperdix

205
[rone number' Program shall ask & then accept the other phone no. Finally it
will print
o\Uottr phone nosl
,Ml',ql--rone no. is 712-595431
Your'ghone no.

14. write a-program that uses structure whose.members


are x & y co-ordinate of a point.
Define &ree points & input values of two points,
carcurate third ioint as sum of other two
points.
:

Enter the co-ordinate for pl : 3 4


Enter the co-ordinate for p2: 5 7
co-ordinate for
p3 : g ll
15' write a structure called volume that uses three variables
of type distance.
Initialize the
u'.v
--' -r:rq$r'lzv
structure for specific dimension and calculate
the volume ni; .;.
16' An election is contested by 5 candidates. The candidates
are numbered I to 5 and voting
is done by marking the candidate number on
the bailot p"p"r.-w.i" u p.og.u,n a."ui
the ballots and count the votes casr for each candidar"
uring un

;;i"bj;;;,:l;

-.";
case' a number read is outside the range I to
5, the ballot should to clnsidered
ballot and the program shourd also count the number
of spoilt bailots.

",

; ;;"i;

17' Define a structure that can describe a hotel. It should


have members that include the
name, address, average room charge and number,of
rooms. Write a progrurn ,o g",

l8'

information for 5 hotels and print the sarne.


Define a structure called cricket that will describe

Player name

the following information

Team name

Batting average
using cricket, decrare an array player with 5 erements
and write a program to read the
information about all 5 players and print list containing
names of player
and their batting

average.

l9'

write a program that will generate a data file containing


the list of the customers and their
corresponding terephone numbers. Use a structure
variible to store;;;;;;;;;;*;
of each customer. 'use command line arguments a

20' A Maruti car dealer


Velicle

type

rporry ,r,-fil" nu*".

maintains a record of sales of various

Month

,"ni.t",

in the following form:


e ---""'

price

of sales

MARUTHI-8OO

0287

MARUTHI-DX

75000

0787

95000

MARUTHI-VAN
Gypsy
write

0488
0888

85OOO

ll,oooo

a program to read the above data from user


and store the data in the datafile labeled

by the user.
21. Extend the program 20 to read the data
from datafile and print the information on the
user
22. write a program to read. the_1ee of 100 persons
and write the name of persons in the age
group

50 ro 60 in the datafile labeled by the

23.

write

user.

a C program to find out the heat transferred


through slab and sphere. The required

inputs for calculation of heat transfer through


,luU
higher temperature, lower temperature,and thermar

uri ti.l*grr,,'Ur.^ail ;1;;;;

""rar"iirirv.'"it."ourp",

ET&F--

required is

206
24.

Computer Graphics lncluding CAD, AutoCAD and C


amount of heat transfer through the slab. For sphere inputs are inside and outside radius,
thermal conductivity, inside higher temperature and outside lower temperature.
Wnte a C-program for Inventory models i.e Deterministic and probabilistic inventory
models with shortage and without shortage to find out the optimum lot size (economic
order quantity), total variable cost, orders per year and the time between the order.
The required inputs for deterministic models are

(a) Carrying or inventory cost(units per year)


(b) Setup cost (units per run)
(c) Demand rate. These inputs for No shortage.
For shortage, additional inputs is the shortage cost.
Outputs are:

(rz) Optimum lot

size.

(b) Maximum inventory


(c) Total manufacturing
(d) Total time required.

time and

A. Inputs for probabilistic Demand models are,


the number of discrete demand observation.
the quantity of demand for observation
the probability for these demands.

(c) Enter
(b) Enter
(c) Enter

Outputs are

(a) Holding cost per item


(b) Shortage cost per item
25. Write a C-program to calculate

the Shear force and Bending moment for simply supported


and cantilever beams. The inputs given for simply supported beam are

(a) Length of the beam


(b) Magnitude of load and distance from the left end.
(c) Reactions at left and right ends.
The outputs

will

be

(a) Shear forces at different points


(b) Bending moment at different points
26. Write a C program to calculate the probability of

acceptance

for sinqle sampling

and

Double sampling. Inputs for single sampling plan are

(n) Lot size of parts (N)


(D) Sample size (n)
(c) Number of defective in the sample(c)
for double sampling inputs will be percentage defective, two sample size (n, rr,) and
their respective defectives (cr, c2)
The output is the probability of acceptance.

27. Write a C program to find

the sequence of jobs to be performed on two machines. Inputs

are

(n)

number of jobs to be sequenced


(D) enter time for respective jobs for machine
The output is the sequence of Job number.

and machine 2.

opdtition' The inputs required


::'"

te Are program to find standard time of un

are

of elements in the job


for each element.
irri'ffiirf r"&;i ana uu*unce for each element.

wOmUet

2g. write a c'program for prepdra{on'o,f, tBarks:stet''inputs,given aro''


:"::
'r: -'
(a) Enterthenameof student
"'' : ''r
(&) RoIl nuh,ber
:" :i'r:' ''
(c) Marks obtained in each subject.
makfor failed
Outputs: marks sheet with result(pass or fail) and percentagd' "#l:
:

I
I

I
I

t
I

-:il:

ilr;

:*.
116

sAbject'

APPENDIX C
AUTOCAD PRACTICE
l.
2.

3'
4.

Set grid spacing to I unit and snap spacing to 0.5 unit.


Draw a line between (1,4) and (5,6).
Draw a line starting from point (2,2) and having length equals 3 and making angle
of 40o
with positive X-axis.

Draw the triangle shown.

(3, 1)

5. Draw the following

6. Draw a circle

(7, 1.5)

rectangle.

of diameter 5 and having center (6,6).

7. Draw two concentric circles having diameter 6 and g and having


center (7,7).
8. Draw a eircle ha','ing center (5,5) a;rd r,..Jius 3 then draw the line having

end points
and t8,2), finally draw rhe circre tangent to both objects having radius 2.
9. Draw the arc having end points (2,2) and (6,2) and rengrh of chord
equars 4.
10. Draw the lollowing figures.

ll.

,r!

Draw using polyline (pline) following figures

,,rfr

208
[i--

(l,l)

(,,,)

12.

209

(iv)

Dra w the following polygons.

(ii)

(,)

\-,
(iii)

n
1t

A
V
3

(rv)

13. Draw the ellipse having major axis equals to 6 and minor axis equals to 3.
14. Draw the ellipse having center (4,4) and semimajor axis length equals 1.5.
15. Write your name and address using 'text' and 'Dtext' command. Set the height of letter
to 0.5.
16. Write the text in diagonal form as,

IOiIPUTIIHB
17. Draw the ellipse with center (2,3) and semimajor and semiminor axes equals 4 and 2
respectively. Move the ellipse by 4 units in X-directions and 2 units in l/-directions.
18. Draw the hexagon of 2 unit side and make 5 copies of hexagon.
19. Draw rectangle of 3 unit in length and 2 unit in width. Rotate the rectangle about its
center in clockwise direction by angle 45.
20. Draw following triangle and rotate it by 40o about Y-axis.
(3,6)

(2,41

(s,4)

21. Draw circle at any center and of radius 3. Scale the circle about its center by
(ii) 0.2 units
(i) 2 units
22. Using mirror command, draw the following object.

:--!!',*-

21O

24.

Computer Graphics lncluding CAD, AutoCAD and C

.*
*

)K. )K

*)(

)K)(

)(

)(*

*)(

)(

Draw following Fig. 24(i) first then reproduce

Fie.2aji)

using break command.

,'

-J

25. Repeat problem 24 using Trim command.


26. Draw Fig. 26(i) first and then reproduce Fig. 26(ii)

fte 26 (i)
27.

fre. 24

I
1

i
i
I

fie.24 (i)

(ii)

using stretch command.

fie.26 (ii)

Using offset command change Fig. 27{i) to Fig. 27(ii).

rte. 27 (i)

rte. 21

(ii)

i
I
i

trE-..

---

Você também pode gostar