I am a biology student but now studying mechanical engineering. I don't have any such a basic knowledge of programming. So, I feel very hard to understand the programmes and coding. After watching this video, I am very clear i. Recursion topic. Thanks
#include int checkForPrime(int); int i; int main() { int n1,primeNo; printf("\t Recursion : Check a number is prime number or not : "); printf(" Enter any number : "); scanf("%d",&n1); i = n1/2; primeNo = checkForPrime(n1); if(primeNo==1) printf(" The number %d is a prime number. ",n1); else printf(" The number %d is not a prime number. ",n1); return 0; } int checkForPrime(int n1) { if(i==1) { return 1; } else if(n1 % i == 0) { return 0; } else { i = i - 1; checkForPrime(n1); } } mam i have a doubt in this code. i understoood the use of i in this code. But, what is logic behind "i=n1/2".
I am a biology student but now studying mechanical engineering. I don't have any such a basic knowledge of programming. So, I feel very hard to understand the programmes and coding. After watching this video, I am very clear i. Recursion topic. Thanks
Fantastic Mam...!!!! Great Job
Thanks Lot
Please check other videos in the channel and also pls share with your friends.
@@LogicFirstTamil Defenetly Mam
it's my pleasure 🥰
@@LogicFirstTamil madam you have to use long keyword in instead of "int" in int fact (int n)
vera level explanation
Very clear explanation mam. Very very thank you mam
Explaining vera level...mam
Good explanation in recursion topic
Excellent 👍👍
Awesome explanation mam
I came from your js video
1000th like 😅
Hi sister.Can you show how to do fibonacci like factorial?
Thanks you ❤️
Thanks Madam🙏
well explained
Thanks mam
In that main function, if we gave it as int main... then we have to write return 0 at the end or not?
yes. we should
super
Ma'am how to student mark recursion vachu yepadi program pannadhu if goto illa ma
👍
🔥
#include
int checkForPrime(int);
int i;
int main()
{
int n1,primeNo;
printf("\t Recursion : Check a number is prime number or not :
");
printf(" Enter any number : ");
scanf("%d",&n1);
i = n1/2;
primeNo = checkForPrime(n1);
if(primeNo==1)
printf(" The number %d is a prime number.
",n1);
else
printf(" The number %d is not a prime number.
",n1);
return 0;
}
int checkForPrime(int n1)
{
if(i==1)
{
return 1;
}
else if(n1 % i == 0)
{
return 0;
}
else
{
i = i - 1;
checkForPrime(n1);
}
}
mam i have a doubt in this code. i understoood the use of i in this code. But, what is logic behind "i=n1/2".
Thank you!