- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
9 Posted Topics
Re: #include<iostream.h> #include<conio.h> void main() { clrscr(); long int f1=0,f2=1,f3; int num; cout<<" Fibonacci Series "; cout<<endl<<endl; cout<<"Enter the number till which Fibonacci series is desired: "; cin>>num; cout<<"The series is : "<<endl; if(num==0) { cout<<""; } else if(num==1) { cout<<"0"; } else if(num==2) { cout<<"0 1 "; } else { … | |
#include<iostream.h> #include<conio.h> void main() { clrscr(); int n,i,n2=1,max; cout<<" Right Triangle 2"<<endl<<endl; cout<<"Enter a number :"; cin>>max; for(i=1;i<=max;i++,n2++) { for(n=1;n<=i;n++) { cout<<n2; } cout<<endl; } getch(); } | |
#include<iostream.h> #include<conio.h> void main() { clrscr(); int n; cout<<" Right Triangle 1 "<<endl<<endl; cout<<"Enter a number :"; cin>>n; for(int a=1;a<=n;a++) { for(int b=1;b<=a;b++) { cout<<b<<" "; } cout<<endl; } getch(); } | |
#include<iostream.h> #include<conio.h> void main() { clrscr(); int num=0; int c=0; cout<<" Prime OR Not"<<endl<<endl; cout<<"Enter a number you want to test for prime number: "; cin>>num; for(int i=2;i<num;i++) { if(num%i==0) { c=0; break; } else { c=1; } } if(num==2||c==1) { cout<<"The number is Prime "; } else { cout<<"The … | |
#include<iostream> using namespace std; int fact(int); main() { int rows,i,j,k; cout<<"Enter the numbe of rows you want in the triangle:"; cin>>rows; for(i=0;i<rows;i++) { //Moving each row by rows-i spaces to get a triangular shape for(k=0;k<(rows-i);k++) cout<<" "; //Loop for printing each row for(j=0;j<=i;j++) cout<<" "<<fact(i)/(fact(j)*fact(i-j)); //nCr=n!/(r!*(n-r)!) cout<<endl; } } int … | |
#include<iostream.h> #include<string.h> #include<conio.h> void main() { clrscr(); int i,j,len,flag=1; char a[20]; cout<<"Enter a string : "; cin>>a; len= strlen(a); for(i=0,j=len-1;i<=len/2;i++,j--) { if(a[j]!=a[i]) flag=0; } if(flag==1) cout<<"\n The string is palindrome. "; else cout<<"\n The string is not palindrome. "; getch(); } | |
#include<iostream.h> #include<conio.h> void main() { clrscr(); int n,num,d,rev=0; cout<<" Enter any num:"; cin>>n; num=n; do { d=n%10; rev=(rev*10)+d; n=n/10; } while(n!=0); if(num==rev) cout<<endl<<"Palindrome "; else cout<<endl<<"Not Palindrome "; getch(); } | |
#include<iostream.h> #include<conio.h> void main() { clrscr(); cout<<" Floyd's Triangle " <<endl<<endl; cout<<"Enter a number till which floyd's triangle is required : "; int max; cin>>max; for(int i=1,num=1;num<=max;i++) { for(int j=1;j<=i;j++,num++) { cout<<" "<<num; } cout<<endl; } getch(); } | |
#include<iostream.h> #include<conio.h> void main() { clrscr(); int num; cout<<" Factorial Program"<<endl; cout<<endl; cout<<"Enter a number : "; cin>>num; int fact=1; for (int i=1;i<=num;i++) { fact=fact*i; } cout<<"Factorial of "<<+num<<" is :"<<fact; getch(); } |
The End.