Nth Fibonacci Number using Command Line Arguments
C Programming Language / Command Line Arguments
526Program:
#include #include int fib(int n) { int a=0,b=1,c,i; if(n==0) return a; for(i=2;i<=n;i++) { c=a+b; a=b; b=c; } return b; } int main(int argc, char * argv[]) { if(argc==1) { printf("No arguments"); return 0; } else { int n; n=atoi(argv[1]); printf("%d",fib(n)); return 0; } }
Output:
10 55
Explanation:
Nope
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS