Skip to content
Open
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
29 changes: 29 additions & 0 deletions Cartesian_Product.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <stdio.h>
#include <conio.h>
int main()
{
int i,j,m,n;
int a[1000000];
int b[1000000];
printf("Enter length of set A and B \n");
scanf("%d%d",&n,&m);
printf("Enter elements of set A \n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("Enter elements of set B \n");
for(i=0;i<m;i++)
scanf("%d",&b[i]);
printf("{");
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
printf("(%d,%d)",a[i],b[j]);
}
}
printf("}");
getch();
return 0;
}


44 changes: 44 additions & 0 deletions Emrip.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/******************************************************************************

Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int prime(int n)
{
int i=2;
while(i<n)
{
if(n%i==0)
break;
i++;
}
if(i!=n)
return false;
return true;
}

int main()
{
int n,c,r=0,i,a;
cin>>n;
a=n;
while(a>0)
{
r=r*10+a%10;
a=a/10;
}
if( prime(n) && prime(r))
{
cout<<"Emrip Number";
}
else
cout<<"Not an emrip number";
return 0;
}
33 changes: 33 additions & 0 deletions decimalToBinary.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/******************************************************************************

Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
int i,j,k,l,m,n,a,b,c;
int arr[1000000];
cin>>n;
i=0;j=0;
while(n>0)
{
arr[i++]=n%2;
n=n/2;
j++;
}
while(i>=0)
{
cout<<arr[i];
i--;
}
cout<<"\n";
return 0;
}

32 changes: 32 additions & 0 deletions fibonacci.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/******************************************************************************

Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

void fibo(int a,int b,int n)
{ int c;
if(a<=n)
{
cout<<a<<" ";
c=a+b;
a=b;
b=c;
fibo(a,b,n);
}
}
int main()
{
cout<<"Enter limit n \n";
int n;
cin>>n;
fibo(0,1,n);

return 0;
}