Skip to content

Instantly share code, notes, and snippets.

View m-ahmedy's full-sized avatar
🎯
Focusing

Mahmoud Ahmedy m-ahmedy

🎯
Focusing
View GitHub Profile
@m-ahmedy
m-ahmedy / arrFind.cpp
Created May 19, 2017 15:26
Find value in array elements.
#include <iostream>
using namespace std;
int main()
{
int arrSize, value;
bool found=false ;
cout<<"Enter array size: ";
@m-ahmedy
m-ahmedy / concat.cpp
Created May 19, 2017 11:55
Concatenate
#include <iostream>
using namespace std;
int main()
{
const int size1=5 , size2=6 , newSize=size1+size2;
int arr1[size1], arr2[size2] , newArr[newSize];
cout<<"Enter arr1 data: "<<endl;
@m-ahmedy
m-ahmedy / arrSort.cpp
Last active May 22, 2017 16:39
arrSort
#include <iostream>
using namespace std;
void swapper(int& x,int& y)
{
int temp=x;
x=y;
y=temp;
}
@m-ahmedy
m-ahmedy / isPrime.cpp
Last active May 18, 2017 12:00
A function that checks whether a number is prime or not + Factorial function with recursion.
#include <iostream>
using namespace std;
bool isPrime(int N){
int divider;
for(divider=N-1 ; divider>1 && N%divider!=0 ; divider--);
if(divider==1)return true;
else return false;
@m-ahmedy
m-ahmedy / getSumNeg.cpp
Created May 17, 2017 18:36
A function that returns the sum of all negative elements within an array.
#include <iostream>
using namespace std;
int getSumNeg(int a[],int a_length)
{
int sum=0;
for(int i=0 ; i<a_length ; i++)
{