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
What do you mean by dynamic memory allocation in c? What functions are used?
Is array a primitive data type in c?
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
Explain what is the heap?
If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?
What is multidimensional arrays
What does %p mean?
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
How does selection sort work in c?
How would you obtain the current time and difference between two times?
What is break in c?
What is gets() function?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
What is memory leak in c?