diff --git a/11 May/problem01/problem01.cpp b/11 May/problem01/problem01.cpp new file mode 100644 index 0000000..ff93150 --- /dev/null +++ b/11 May/problem01/problem01.cpp @@ -0,0 +1,17 @@ +#include + +using namespace std; + +int main() +{ + int arr[] = {1,1,2,2,3,4,4,5,5}; + int len = sizeof(arr)/sizeof(arr[0]); + int i ,result = arr[0]; + + for(i = 1;i < len; i++) + { + result = result ^ arr[i]; + } + + cout<<"Print the single number: "< +using namespace std; + +int main() +{ + int number; + cout<<"Please enter a digit: "; + cin>>number; + + if(number == 0 || number == 1) + { + cout<<"Sqaure root of the given number is :"< +#define N 3 + +using namespace std; + +int main () +{ + + int count=0,i,j; + int arr[N][N]; + + //Input matrix elements + cout << "Enter elements "<< N*N <<" of array:" << endl; + for(i = 0; i < N; i++) + { + for(j = 0;j < N; j++) + { + cin>>arr[i][j]; + } + cout<= 0) + sum += arr[i - 1][j]; + + if (i + 1 < N) + sum += arr[i + 1][j]; + + if (j - 1 >= 0) + sum += arr[i][j - 1]; + + if (j + 1 < N) + sum += arr[i][j + 1]; + + + for(int k=2;k <= sum/2;k++) + { + if (sum % k == 0) + { + isPrime = false; + break; + } + } + if (isPrime) + count++; + + } + + } + + cout <<"Output: "<< count < +#define N 3 + +using namespace std; + +int main() +{ + int arr[N][N]; + int search=0,i,j,flag = 0;; + + cout<<"Please enter "<>arr[i][j]; + } + cout<>search; + + for(i = 0; i < N; i++) + { + for(j = 0;j < N; j++) + { + if(search == arr[i][j]) + flag = 1; + } + } + + if(flag == 1) + cout<<"Number Found at ("< +#define N 4 + +using namespace std; + +int main() +{ + int arr[N][N]; + int search=0, i, j, flag = 0, count = 0; + + cout<<"Please enter "<>arr[i][j]; + } + cout< + +using namespace std; + +int main() +{ + int arr[] = {1,1,2,2,3,4,4,5,5}; + int len = sizeof(arr)/sizeof(arr[0]); + int i ,result = arr[0]; + + for(i = 1;i < len; i++) + { + result = result ^ arr[i]; + } + + cout<<"Print the single number: "< +using namespace std; + +int main() +{ + int number; + cout<<"Please enter a digit: "; + cin>>number; + + if(number == 0 || number == 1) + { + cout<<"Sqaure root of the given number is :"< +#define N 3 + +using namespace std; + +int main () +{ + + int count=0,i,j; + int arr[N][N]; + + //Input matrix elements + cout << "Enter elements "<< N*N <<" of array:" << endl; + for(i = 0; i < N; i++) + { + for(j = 0;j < N; j++) + { + cin>>arr[i][j]; + } + cout<= 0) + sum += arr[i - 1][j]; + + if (i + 1 < N) + sum += arr[i + 1][j]; + + if (j - 1 >= 0) + sum += arr[i][j - 1]; + + if (j + 1 < N) + sum += arr[i][j + 1]; + + + for(int k=2;k <= sum/2;k++) + { + if (sum % k == 0) + { + isPrime = false; + break; + } + } + if (isPrime) + count++; + + } + + } + + cout <<"Output: "<< count < +#define N 3 + +using namespace std; + +int main() +{ + int arr[N][N]; + int search=0,i,j,flag = 0;; + + cout<<"Please enter "<>arr[i][j]; + } + cout<>search; + + for(i = 0; i < N; i++) + { + for(j = 0;j < N; j++) + { + if(search == arr[i][j]) + flag = 1; + } + } + + if(flag == 1) + cout<<"Number Found at ("< +#define N 4 + +using namespace std; + +int main() +{ + int arr[N][N]; + int search=0, i, j, flag = 0, count = 0; + + cout<<"Please enter "<>arr[i][j]; + } + cout< + +using namespace std; + +class Height +{ + float meter; + float centimeter; + + public: + void get() + { + cout<<"Please enter Height informatin in m and cm: "<>meter>>centimeter; + } + + Height add(Height& h) + { + Height a; + a.meter = meter + h.meter; + a.centimeter = centimeter + h.centimeter; + return a; + } + + void print() + { + cout<<"Addition of two height objects is: "< +#include +#include + +using namespace std; + +class Triangle +{ + public: + int areaTriangle(int h, int b) + { + cout<<"Function called with 2 parameters"<