#include <iostream>
using namespace std;
int factorial(int n)
{
int fact = 1;
for (int i = 1; i <= n; i++)
{
fact *= i;
}
return fact;
}
int combination(int n, int r)
{
return factorial(n) / (factorial(r) * factorial(n - r));
}
void printPascal(int numRows)
{
for (int i = 0; i < numRows; i++)
{
for (int j = 0; j <= i; j++)
{
cout << combination(i, j) << " ";
}
cout << endl;
}
}
int main()
{
int numRows = 6;
cout << "Pascal Triangle:" << endl;
printPascal(numRows);
return 0;
}
using namespace std;
int factorial(int n)
{
int fact = 1;
for (int i = 1; i <= n; i++)
{
fact *= i;
}
return fact;
}
int combination(int n, int r)
{
return factorial(n) / (factorial(r) * factorial(n - r));
}
void printPascal(int numRows)
{
for (int i = 0; i < numRows; i++)
{
for (int j = 0; j <= i; j++)
{
cout << combination(i, j) << " ";
}
cout << endl;
}
}
int main()
{
int numRows = 6;
cout << "Pascal Triangle:" << endl;
printPascal(numRows);
return 0;
}
❤5🤔1
❤3👍2🔥2
Data Structures and Algorithms .pdf
17 MB
كتاب (الخوارزميات وهياكل البيانات في لغة البرمجة ++C)
لغة الكتاب : الإنجليزية
الكتاب ممتع جداً أنصح به
لغة الكتاب : الإنجليزية
الكتاب ممتع جداً أنصح به
👍3🔥1
آخر ساعة من يوم الجمعة أدعوا لأ نفسكم ووالديكم وأوطانكم بالخير ..
❤4
تتبع الكود التالي واختار المخرجات :
int w=-20;
int x=8; w+=+20; w++; x=(w%2)+2; x--; --x; w=x; x=w; w*3; x*4; x+=2*w; w+=2*x; cout<<w+x;
int w=-20;
int x=8; w+=+20; w++; x=(w%2)+2; x--; --x; w=x; x=w; w*3; x*4; x+=2*w; w+=2*x; cout<<w+x;
Anonymous Quiz
30%
28
31%
10
14%
18
25%
48
👍4❤3👎2
بعض المواقع الي راح تفيدك في التدريبات والتمارين البرمجية :
codeabbey.com
hackerearth.com
exercism.io
codewars.com
hackerrank.com
coderbyte.com
codeabbey.com
hackerearth.com
exercism.io
codewars.com
hackerrank.com
coderbyte.com
🔥7👍1
اللهم إنا نستودعك النيجر 🇳🇪
دعواتكم لأخواننا في النيجر
يريدوا الحرية والأستقلال
من عبودية العدو الفرنسي البغيض
وفرنسا تريد تركيعهم عبر ادواتها في افريقيا
دعواتكم لأخواننا في النيجر
يريدوا الحرية والأستقلال
من عبودية العدو الفرنسي البغيض
وفرنسا تريد تركيعهم عبر ادواتها في افريقيا
❤8💔1
#include <iostream>
using namespace std;
void swap(int &a, int &b) {
int temp = a;
a = b;
b = temp;
}
void rearrangeArray(int A[], int size) {
int left = 0, right = size - 1;
while (left < right) {
while (A[left] % 2 == 0 && left < right) {
left++;
}
while (A[right] % 2 == 1 && left < right) {
right--;
}
if (left < right) {
swap(A[left], A[right]);
left++;
right--;
}
}
}
int main() {
int A[] = {1, 66,77,111,78,100,2, 3, 4, 5, 6, 7, 8, 9};
int size = sizeof(A) / sizeof(A[0]);
cout << "Original Array: ";
for (int i = 0; i < size; i++) {
cout << A[i] << " ";
}
cout << endl;
rearrangeArray(A, size);
cout << "Modified Array: ";
for (int i = 0; i < size; i++) {
cout << A[i] << " ";
}
cout << endl;
return 0;
}
using namespace std;
void swap(int &a, int &b) {
int temp = a;
a = b;
b = temp;
}
void rearrangeArray(int A[], int size) {
int left = 0, right = size - 1;
while (left < right) {
while (A[left] % 2 == 0 && left < right) {
left++;
}
while (A[right] % 2 == 1 && left < right) {
right--;
}
if (left < right) {
swap(A[left], A[right]);
left++;
right--;
}
}
}
int main() {
int A[] = {1, 66,77,111,78,100,2, 3, 4, 5, 6, 7, 8, 9};
int size = sizeof(A) / sizeof(A[0]);
cout << "Original Array: ";
for (int i = 0; i < size; i++) {
cout << A[i] << " ";
}
cout << endl;
rearrangeArray(A, size);
cout << "Modified Array: ";
for (int i = 0; i < size; i++) {
cout << A[i] << " ";
}
cout << endl;
return 0;
}
👍5❤2👎1🤔1