#18 C Recursion | C Programming For Beginners

preview_player
Показать описание
#18 C Recursion | C Programming For Beginners

In this video, we will learn about the recursion in C Programming. More specifically, we will learn about the function that calls itself i.e recursive function. In our past videos, we have already learned about functions so checkout the video of functions in C before you dive into this topic.

~
Resources:

Timestamps:
00:00 Start
00:18 C Recursion
01:52 Example: C Recursion
4:38 Programming Task
5:21 Quiz
~

Revise your learning using our C App

Find Programiz elsewhere:

#programiz #learncprogramming #learnc #recusivefunctions #function #recursion #cprogramming #cprogrammingforbeginners #coding
Рекомендации по теме
Комментарии
Автор

🚀 Loved the tutorial? Take it further with Programiz PRO!
Refine your skills, conquer coding fears, and build confidence with interactive lessons, quizzes, and challenges. Strengthen your programming foundation and master C today!

programizstudios
Автор

Please mam upload videos fast ur teaching style is best after so many complicated videos i found yours and it the best

SoniKumari-ymvl
Автор

Q. Which of the following statements is false?

A. A function that calls itself is called recursive function
B. Conditional statement prevents infinite recursive call
C. Recursive Function always return some value
D. None of the above

programizstudios
Автор

I suggest for myself the programming task before seeing the task. Ma'am, your teaching is one of the best I have ever seen so far.

c_learner_on_linux
Автор

Been saving my life, everything seems so smooth and simple

josephmusangu
Автор

Answer is C. a Recursive function doesn't have to return value all the time. It can be used to just pass parameters.

streamvision
Автор

I do not understand where the second number in the sums in the image come from. For example, in the first one where does the6 in (4 + 6 = 10) come from?

Kenara_Music
Автор

#include <stdio.h>
#include <math.h>

int main() {
// Write C code here
int number, result;

printf("Write a whole number:");
scanf("%d", &number);

result = factoriel(number);
printf("Factoriel = %d", result);

return 0;
}

int factoriel(int n){
if (n != 0){
return n * factoriel(n-1);
}
else {
return n+1;
}
}

timetocreate
Автор

Mam please upload videos daily in c programming language

NGOFFICAL
Автор

Hi Padma, Your class is very good and easy to understand. All the best

jaisonabraham
Автор

#include<stdio.h>
#include<math.h>

int main(){

int number, result;

printf("Enter the positive number = ");
scanf("%d", &number);

result=factorial(number);
printf("%d", result);


return 0;
}
int factorial(int n){
if(n != 0){
return n* factorial (n-1);
}
else{
return n+1;
}
}

vishalkadkal
Автор

I've recycled the code of the previous exercise and I've changed the + on the 20th line with *

#include <stdio.h>
int factorial(int n);

int main() {
int number, result;

printf("Enter a number: ");
scanf("%d", &number);

result = factorial(number);

printf("Factorial number = %d", result);


return 0;
}

int factorial(int n){
if (n > 0){
return n * factorial(n-1);
}
else {
return 1;
}
}

rayan_lupo
Автор

programming squeeze

D. None of the above

IfycoolAfrica
Автор

this is where Im starting to struggle. I need to revise more on this topic

DannyDatsWhacc
Автор

/*Create a program that computes the factorial
of a number.
• Take input from user
• Pass the input value to a function.
• Inside the function check if the number is
greater than O.
• If true, return number multiplied by a
recursive call to the function with
parameter 1 less than number
Otherwise, return 1. */

int factorial(int n) {
if (n != 0) {
if (n < 1)
return 1;
return n * factorial(n - 1);
}else
return 1;
}

Selcuk._._
Автор

Your topics are really understandable to me...plz would you like to post Dsa course ...that would be very helpful

hinfarana
Автор

Task:

#include <stdio.h>
#include<math.h>

int mult(int n);

int main() {
int number, result;
printf("enter a number: \n");
scanf("%d\n", &number);

result = mult(number);

printf("multiplication = %d", result);
return 0;
}
int mult(int n) {
if (n > 0) {
return n * mult(n-1);
} else {
return 1;
}
}

Quiz:
D is the correct option.

light-warrior
Автор

#include <stdio.h>
int factorial(int n);

int main() {
int number, result;
printf("Enter the number: ");
scanf("%d", &number);

result= factorial(number);
printf("facoria= %d", result);
return 0;
}
int factorial(int n){
if(n > 0){
return n * factorial(n-1);
}
else{
return 1;
}

}

Eleotblack
Автор

How does the compiler know to convert sum(number) to sum(n) since number and n are not same thing, wouldn't it be better to be consistent with sum(number) ?

onomemafuru
Автор

In the programming task at the end, what if the user inputs a negative value? What will be the new code to indicate that the user input is invalid?

hrkhrld