Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions CPP/even_fibo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

#include<iostream>
using namespace std;

void fibo()
{ long input=0,num1=0,num2=1,i=0,count; // giving default values

cout<<" Enter the limit for the number of output from the series:- ";
cin>>input;
for(i=0,count=0;i<input;i++)
{
if((num1+num2)%2==0)
{cout<<" num"<<count+1<<": "<<num1+num2<<" "; // Printing next number
count++;
}
num1=num1+num2; // moving to the next number by swap
num2=num1-num2;
num1=num1-num2;

num2= num1+num2; // next value updated
}
}

int main(void)
{
fibo(); // Fibo Fucntion call
return 0;
}
25 changes: 25 additions & 0 deletions CPP/large_prime_factor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include<iostream>
using namespace std;

int main()
{
lpf();
return 0;
}

void lpf()
{int num1,num2,i,oldn=1,newn=0;
cout<<" Enter the 2 numbers you want to find the largest prime factor ";

cin>>num;
num2=sqrt(num);
for(i=1;i<num2;i++)
{if(num1%i==0)
{
if(i>newn)
{ newn=i}
}

}
cout<<"\n The largest prime number is "<<newn;
}
22 changes: 22 additions & 0 deletions CPP/multiple_3_n_5.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include<iostream>

using namespace std;

void mul35();

int main(void)
{
mul35();
return 0;
}


void mul35()
{
cout<<" 100 numbers will be displayed :-\n";
int i;
for(i=1;i<=100;i++)
{
cout<<" "<<i<<": "<<3*i<<" - "<<5*i<<" \n";
}
}
Loading