Monday, August 15, 2022
Home C Language looping statement

# looping statement

### Program to printing fibonacci series for first n terms

#include<stdio.h> #include<conio.h> void main() { int n,i; long f0=0,f1=1,f2; clrscr(); printf("n enter nn"); scanf("%d", &n); printf("n Fibonacci series up to %d terms n", n); for(i=1;...

### Program to finding factorial of a number

#include<stdio.h> #include<conio.h> void main() { int n,i; double f=1; clrscr(); printf("n Enter nn"); scanf("%d", &n); for(i=1;i<=n;++i) f=f*i; ...

### Program to finding sum of 1/2+2/3+3/4+………….n/n+1

#include<stdio.h> #include<conio.h> void main() { int n,i; float s=0; /* s for sum which is a float value as division occurs */ clrscr(); printf("n Enter nn"); ...

### Program to finding sum of 1 to n

#include<stdio.h> #include<conio.h> void main() { int n,i; long s=0; /* n for given number, s for sum */ clrscr(); printf("n Enter n n"); ...

### Program to print multiplication table for any given number

#include<stdio.h> #include<conio.h> void main() { int i,n; /* i for loop counter, n for given number for which, we have print ...

### Program to print all even numbers from m to n using for loop

#include<stdio.h> #include<conio.h> void main() { int i, n, m; /* i for loop counter, m is lower limit, n for upper limit */ clrscr(); printf("n...

### Program to print all odd numbers from m to n using for loop

#include<stdio.h> #include<conio.h> void main() { int i,n,m; /* i for loop counter, m is lower limit, n for upper limit */ clrscr(); printf("n...

### Program to print all numbers from m to n using for loop

#include<stdio.h> #include<conio.h> void main() { int i,n,m; /* i for loop counter, m is lower limit, n for lower limit */ clrscr(); printf("n Enter lower limit...

### Program to print 1 to n numbers using for loop

#include<stdio.h> #include<conio.h> void main() { int i,n; /* i for loop counter, n for the extreme boundary */ clrscr(); printf("n Enter the upper limitn"); scanf("%d",&n); printf("n...

### Python program to find the GCD of two numbers using recursive

def gcd(x,y):     if(y==0):       return x     else:       return gcd(y,x%y) x=int(input("Please enter first number: ")) y=int(input("Please enter second...

### Python program to check find the given year is a leap year or not

year=int(input("Please enter a year to be check leap year or not: ")) if(year%4==0 and year%100!=0 or year%400==0): print("This year is a leap...

### Python program to find the LCM of two numbers using recursive

def lcm(a,b): lcm.multiple=lcm.multiple+b if((lcm.multiple % a == 0) and (lcm.multiple % b == 0)): ...