Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
C-loops and control statement-7

C-loops and control statement-7

Ratings:

4.0

(1)
|Views: 494 |Likes:
Published by vinitajenny

More info:

Published by: vinitajenny on Sep 02, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

05/09/2014

pdf

text

original

 
LOOPs and Basic control statements
1 Calculate n! (i.e. n factorial) wherea.if n>0 then n! = 1*2*3*4*5…*nb.n=0 then n!=1c.n<0 then n! is not defined2.Check whether given number is Armstrong or not? [Armstrong numbermeans sum of cube of digits is equivalent to number itself. E.g. 153 is anArmstrong number.]3.Print Fibonacci series: - 1,1,2,3,5,8,13… (Hint: After the first two numbersin the series, each number is the sum of the two preceding numbers.)4..Wap To read integers (until user enters 0 to stop); find sum, average, maxand min of these integers added by user.5. Determine and print the sum of the following harmonic series for agiven value of n:a.1 + ½ + 1/3 + ¼ +. …+ 1/n
 b.Given that PI = 4(1-1/3+1/5+1/9+1/14+…)
Write a program to evaluate the value of PI as the sum of 10 terms or20 terms ,… or 100-terms and print as per the following formatc.No. of Terms | Value of PId.--------------------------------------e.<<your ans>>f.<<your ans>>g.. .h.. .i.. . j.<<your ans>>k.* 6. Witnesses at the scene of a crime gave descriptions about two suspects whowere in hurry. The first suspect was described as being short and heavy (height<165 cm and weight >90 kg) and the second suspect was described as being talland thin (height >190 cm and weight <60 kg). Write a c-program to input heightand weight of known criminal-pairs in the area and to printout it is suspect ornot.a)Read above problem. Now read a no. N from user. Then read heights andwidths of N criminal-pairs and print whether they are criminals or not.7. The cost of operating an electrical device is determined by the formula –
 
a)C = WTK/1000Where, W = no. of wattsT = Time in hoursK = cost (in Rs.) per Kilowatt hoursIt is required to print a table showing the cost for various values of W from 100watts to 1000 watts, increment with 50 watts. T from 1 hour to 10 hours, steps of1 hour. K from Rs. 1.50 to Rs. 10.00 steps of 50 paise.a.So, now write a menu based program thatb.shows menu with menu-items : Watts, Time and Unit-Cost andthenc.accepts choice form userd.and prints table as per choice entered by the user.8 Write a do-while loop to evaluate and print the values of the quadraticpolynomialy=x
2
+10x-11 for the value of x = 0.0 to 1.0 with steps 0.2.9 Write a for loop to print the numbers between –1 and –30 and their squaresand cubes.10 Read n numbers from user and find maximum and minimum of thosenumbers.11 Read numbers from user till he wants; also calculate sum of sum of positivenumbers and product of negative numbers.12 Find the sum of first and last digit of an integer number.13 1! + 2! + 3! + …+n!14 X X
3
/3! + x
5
/5!-x
7
/7!+…15 Generate a menu-driven calculator that will accept two numbers from theuser and ask for the choice to add, subtract, multiply, divide or exit. After theresult is calculated and displayed as per the user’s choice; the program shouldask the user whether he wants to continue calculations or not.16 Generate the series:- 1,-3,5,-7,9,-11,13…(1
st
N numbers).17 Generate a menu-driven Temperature-conversion program. The menu shoulddisplay three options: (1) Fahrenheit-to-Celsius (2) Celsius-to-Fahrenheit (3) Exit.The program should accept user’s choice and then should functionappropriately. This process function till user does not exit.

Activity (2)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->