Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added bit header file in code #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
19 changes: 12 additions & 7 deletions CPP_Programming/CheckPrime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@

#include<iostream>
using namespace std;

int prime(int n)
{
int flag=0;
for (int i=2; i<=n/2; i++) {
if (n%i==0)
flag=1;
}
return flag;
}
int main()
{
int n,i,flag=0;
int n,ans=0;
cout<<"Enter any number: ";
cin>>n;
for (i=2; i<=n/2; i++) {
if (n%i==0)
flag=1;
}
if (flag==0)

if (prime(n))
cout<<n<<" is a prime number.";
else
cout<<n<<" is a composite number.";
Expand Down
Binary file added CPP_Programming/CheckPrime.exe
Binary file not shown.
Binary file added CPP_Programming/CheckPrime.o
Binary file not shown.
13 changes: 7 additions & 6 deletions CPP_Programming/HCF.CPP
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
Author: Eshaan Bansal
Date: 23/09/2016 */

#include<iostream.h>
#include<bits/stdc++.h>
using namespace std;
#include<conio.h>

void main() {
int main() {


clrscr();
int a,b,N,D,R=1,HCF;
cout<<"\nEnter 2 numbers: ";
cout<<"Enter 2 numbers: "<<endl;
cin>>a>>b;
if (a>b) {
N=a;
Expand All @@ -31,5 +32,5 @@ void main() {
}
}
cout<<"HCF of "<<a<<" and "<<b<<" is: "<<HCF;
getch();
}

}
Binary file added CPP_Programming/HCF.exe
Binary file not shown.
Binary file added CPP_Programming/HCF.o
Binary file not shown.