Recursion is used on large problems that can be broken down into smaller, repetitive problems. It is especially implement on branches and large or complex iterative approach.
Write a C Program to Print Fibonacci series user given range using recursion , C program : Code: #include<conio.h> #include<stdio.h> void main() { int fibo(int); int n,i; printf("Enter the range of fibo:\n"); scanf("%d",&n); for(i=0;i<=n;i++) printf("%d\t",fibo(i)); getch(); } int fibo(int i) { if(i==0 || i==1) return 1; else return (fibo(i-1)+ fibo(i-2)); } Output:
2021 PROGRAMMING LANGUAGES : You should learn this languages that will help to sustain and compatible in the year 2021. It help to boost your programming skills and fight with current technology. You will be able to think critically and with advance knowledge you can crack any coding interviews. Top 10: 10. KOTLIN Kotlin can be used for any kind of development, be it server-side, client-side web and Android. With Kotlin /Native currently in the works, support for other platforms such as embedded systems, mac-OS and iOS. 9. SWIFT Swift is a general-purpose programming language built using a modern approach to safety, performance, and software design patterns. The goal of the Swift project is to create the best available language for uses ranging from systems programming, to mobile and desktop apps, scaling up to cloud services. 8. SCALA : Scala combines object-oriented and functional progra...
Reverse a list: a=[1,9,7,3,8,6] #list a.reverse() print(a) #reverse list Output : [6,8,3,7,9,1] Lower case to Upper: lines = [] while True : var = str(input()) if var: lines.append(var.upper()) else : break; for i in lines: print (i) Output: hello world HELLO WORLD
Recursion is used on large problems that can be broken down into smaller, repetitive problems. It is especially implement on branches and large or complex iterative approach.
ReplyDelete