Using for loop c programmes

Great! Practicing for loops in C is an excellent way to strengthen your understanding of programming logic and structure. Here are 10 C programming exercises using for loops for practice, from beginner to intermediate level: --- ✅ 1. Print Numbers from 1 to N Goal: Input n and print numbers from 1 to n. int n; printf("Enter a number: "); scanf("%d", &n); for (int i = 1; i <= n; i++) {     printf("%d ", i); } --- ✅ 2. Sum of First N Natural Numbers Goal: Input n, output sum 1 + 2 + ... + n. int n, sum = 0; printf("Enter a number: "); scanf("%d", &n); for (int i = 1; i <= n; i++) {     sum += i; } printf("Sum = %d\n", sum); --- ✅ 3. Factorial of a Number Goal: Input n, calculate n!. int n, fact = 1; printf("Enter a number: "); scanf("%d", &n); for (int i = 1; i <= n; i++) {     fact *= i; } printf("Factorial = %d\n", fact); --- ✅ 4. Multiplication Table Goal: Input n, print tabl...

Mathematics:: Topic- Boat and stream

6. A girl was travelling in a boat, suddenly
wind starts blowing and blows her hat and
started floating back downstream. The boat
continued to travel upstream for 12 more

minutes before she realized that her hat had
fallen off. She turned back downstream and
she caught her hat as soon as she reached
the starting point. If her hat flew off exactly
2km from where she started. What is the
speed of the water?
A) 12km/hr
B) 8km/hr
C) 5km/hr
D) 9km/hr
E) 10km/hr
View Answer
Option C
Solution:
Distance = 2 km
Time = 2 * 12 (doubles ) = 24 mins. = 2/5
hr.
Speed = 2 / (2/5) = 5 km/hr.
7. A ship sails 30km of a river
towards upstream in 6 hours. How long
will it take to cover the same distance
downstream. If the speed of the current is
(1/4)rd of the speed of the boat in still
water.
A) 2 hrs
B) 4.5hrs
C) 5 hrs
D) 3.6hrs
E) 5.5 hrs
View Answer
Option D
Solution:
Let x be speed of the boat and y be the
speed of the current.
Downstream speed = x + y
Upstream speed = x – y
x –y = 30/6 = 5 km/hr.
Now,
x = 4y
x – y = 4y – y = 3y
=> x = (20/3)km/hr and y = (5/3)km/hr
Therefore, x + y = (25/3) km/hr.
Time during downstream = 90/25 =3.6 hrs.
8. A man can row 6km/hr in still water. If the
speed of the current is 2km/hr, it takes 4
hours more in upstream than in the
downstream for the same distance. Find the
distance.
A) 44km
B) 40km
C) 32km
D) 50km
E) 45km
View Answer
Option C
Solution:
Let the distance be D.
Downstream speed = 8 km/hr
Upstream speed = 4km/hr
From the question,
Upstream = Downstream + 4
D/4 = D/8 + 4
D/4 = (D + 32)/8
D = 32 km
9. The speed of the motor boat is that of the
current of water is 36:5 . The boat goes
along with the current in 5 hours 10
minutes . How much time it will take to
come back .
A) 45/2
B) 41/6
C) 55/3
D) 38/7
E) 52/8
View Answer
Option B
Solution:
S1/S2 = T1/T2
(36 + 5)/(36 – 5) = x/(31/6)
=> x = 41/6 = 6 hours 50 minutes
10. In a fixed time, a boy swims double the
distance along the current that he swims
against the current. If the speed of the
current is 3km/hr. , then what is the speed
of the boy in still water ?
A) 9 km/hr
B) 13km/hr
C) 15km/hr
D) 22km/hr
E) 10km/hr
View Answer
Option A
Solution:
Let the speed of boy in still water be x
km/hr
and the speed of current is given = 3 km/hr
Downstream speed = (x+3) km/hr
Upstream speed = (x-3) km/hr
Let time be t hours
(x+3)*t = 2 {(x-3)*t}
=> x = 9 km/hr
1. A man can row 40 kmph in still water and
the river is running at 10 kmph. If the man
takes 2 hr to row to a place and back, how
far is the place?
A) 38km
B) 37.5km
C) 40.75km
D) 41km
E) None
View Answer
Option B
Solution:
Given u=40 , v=10
D= t[(u2
-v
2
)/2u]
=2*[(402
-102
)/2*40]
=2*(1600—100)/80
2*1500/80==>37.5km
2. A man rows to a place 60 km distant and
come back in 35 hours. He finds that he can
row 4 km with the stream in the same time
as 3 km against the stream. Find the speed
in still water and in stream:
A) 1.5, 2
B) 0.5, 2.5
C) 3.5, 0.5
D) 2, 2.5
E) None
View Answer
Option C
Solution:
If he moves 4 km downstream in x hours.
Downstream speed=4/x
Upstream speed=3/x
Then 60/(4/x) + 60/(3/x)=35
60[(3x+4x)/12]=35
60*7x/12=35
5*7x=35==> x=1km.
Then Downstream speed=4km/hr ,
Upstream speed=3km/hr
U=(4+3)/2=7/2=3.5km/hr
V=(4-3)/2=1/2=0.5km/hr

3. Speed of a boat in standing water is 12
kmph and the speed of the stream is 3
kmph. A man rows to a place at a distance
of 6300 km and comes back to the starting
point. The total time taken by him is:
A) 1120hrs
B) 1000hrs
C) 980hrs
D) 850hrs
E) None
View Answer
Option A
Solution:
Downstream speed = (12 + 3) = 15 km/hr
Upstream speed = (12 – 3) = 9 km/hr
Total time taken =6300/15+6300/9
=420+700==>1120hrs.


Comments

Popular posts from this blog

python in brief

advance loop based C programmes