25. It takes five minutes to pass a rumour from one
person to two other persons. The tree of rumour continues.
Find how many minutes does it take spread the rumour to 768
persons. ?
Answer Posted / pradeep
Yes Bindu, You are right and thanks for correcting me.
and the right answer is 35 minutes.
Please find the logic and the program below:
int ppl , time , i , sum = 0;
printf("Enter the number of ppl u want to spread \r\n");
scanf("%d",&ppl);
while(sum<ppl)
{
sum = pow(3,i);
time = 5 * i;
i++;
}
printf("time in min required is %d \r\n",time);
[
out put:
Enter the number of ppl u want to spread
768
time in min required is 35
]
==================
For your refernce :
1->2 [ total 3 ppl ] took 5 min;
3 -> 6 [ total 9 ppl ] took 10 min
9 ->18 [ total 27 ppl ] took 15 min ..
27 -> 54 [ total 81 ppl ] took 20 min
81 -> 162 [ total 243 ppl ] took 25 min
243 -> 486 [ total 729 ppl ] took 30 min
729 -> 1458 [ total 2187 ppl ] took 35 min
overall it's power of 3
============================
| Is This Answer Correct ? | 19 Yes | 3 No |
Post New Answer View All Answers
How do you override a defined macro?
Is a house a shell structure?
What is switch in c?
What is clrscr in c?
What is sizeof int in c?
Write a c program to demonstrate character and string constants?
What is the difference between typedef and #define?
What is non linear data structure in c?
How do you list a file’s date and time?
What is header file definition?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
How can I make sure that my program is the only one accessing a file?
Do you have any idea how to compare array with pointer in c?
How can you find out how much memory is available?
How can I use a preprocessorif expression to ?