Popular posts from this blog
Print name in a pattern | name as abbreviation | C-Program
Write a c program to display the name in the following pattern. If the name is Rahul Das than it should display R.Das . Print abbreviation name: Tips:- Use character array to store stuff given by user. You need to use strlen function which is present in the string.h header file to find the length. Code:- #include<stdio.h> #include<string.h> //for strlen() funtion. void main() { char name[20]; int var=0,n=0; printf("Enter Your name :- "); gets(name); var=strlen(name); for(int i=0;i<=var;i++) { if(name[i]==' ') { n=i+1; } } printf("\nYour attribute is :- "); printf("%c.",name[0]); for(int j=n;j<var;j++) { printf("%c",name[j]); } printf("\n\n"); } Output:-
Print Fibonacci Series using Recursion | C program :
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:
Comments
Post a Comment
Give your feedback!
DO NOT SPAM !!
NO THIRD PARTY PROMOTIONAL LINK !!!! (else comment will be deleted.)