Functions (Solved Question 1)

preview_player
Показать описание
C Programming & Data Structures: Functions (Solved Question 1)
Topics discussed:
1) Solution of GATE-2014 (CSE) problem on Functions in C.
2) Homework problem on Functions in C.

Music:
Axol x Alex Skrindo - You [NCS Release]

#CProgrammingByNeso #CProgramming #CFunctions
Рекомендации по теме
Комментарии
Автор

Starting by incrementing from count(2)
Count(2): 110110011__ itr0
Count(3): 001101100__itr1
Count(4): 000011011__itr2
Count(5):
Count(6):
Count(7):
After count(7) we get out of the loop.

data.practitioner
Автор

Ans is 7.
#include<stdio.h>
int fun(int a){
int count=2;
while(a){
count++;
a>>=2;
}
return count;
}
int main(){
int a;
a=435;
fun(a);
printf("the value of a: %d\n", fun(a));
return 0;
}

ShivamKumar-ieje
Автор

Sir the you provided here is extremely beautiful in every way and can you please provide c++ oops concept

vesangisaichaitanya
Автор

I am too late to watch this series but really this is best series for learning c and data structures....

lalit
Автор

the answer is 7, as the count starts from 2 and the loop terminates after 5 iteration so 5+2=7.

IntradayWithShahid
Автор

lot of years im search a good tutorial for c but now i find a gold tutorial...super presentation and simple and quality examples

nareshsachin
Автор

Value of count is 7.And the loop terminates after 5 iterations. Initially the value of count is 2 and after 5 iterations it will be 5+2=7.

megaraina
Автор

I have a little bit different approach. As it is a right shift that also we have to do 2 times per iteration so as discussed in previous lectures in right shift we divide no. By
2^(no. Of bits to right shift)
so here no. Of bits to shift is 2 so we will divide by 2^2 i.e. by 4. So when we count the iteration along with dividing no. The loop will terminated at 5th iteration as at 5th iteration the value i.e. the no. Will be 0 after dividing. So the final answer is 5+2 = 7. i.e. count =7

shreyassakriofficial
Автор

Here num is 435 (110110011) and count=2, if we shift right the number like
001101100(3), here 3 after count (2 )give that, for understanding
Similarly,
000011011(4)



After counting it gives 7 if we count after 2 and another simple way is 2+5=7.

nforme
Автор

435= 110110011 c=2
//right shift 2
num=001101100 c=3
num= 000011011 c=4
c=5
c=6
c=7
Ans= 7

ChintanDhokai
Автор

1. 435/4 = 108; count=3
2. 108/4 = 27; count=4
3. 27/4 = 6; count=5
4. 6/4 = 0; count=6 1/4=0 count=7 (final answer)

Aabara_ka_dabara
Автор

The Answer is 7
Thanks sir for your effort

theprofessorhetsron
Автор

It is really useful for my gate preparation thank you sir

kishors
Автор

I got 7 for the count: 5 loop iterations for the shifts plus the initial 2 of count.

mohamedkanu
Автор

7
is the value returned by the function

tulakchowdhury
Автор

When count = 7 num contains 0 value.So the condition became false and we came outside of the loop and return the value of count which is 7.So 7 is the right ans.

srinjaydas
Автор

He should be a private tutor for c he deserves even more i prefer to watch his videos rather than other hindi programming videos

Ankit-ziyf
Автор

7 will be the answer. God, I am getting correct answers. So, enough for today going to sleep and have a good dream.

simasaha
Автор

Count = 2 (Initial Value)
Count = 7 (Final Value)

Answer is Count = 7

DeepakThakurEntrepreneur
Автор

I think it can be done with the shortcut formula you told in previous videos i.e. in right shift we divide the given number by 2^number

shreedharchavan