Information Technology "IT" - level 4
500 subscribers
688 photos
40 videos
834 files
170 links
رابط قناة المراجع والملخصات والنماذج والمحاضرات
@Al_Adeeb_Group
Download Telegram
نماذج اختبار البرمجه اليوم..
#include <iostream>
using namespace std;

int x(int a,int b)
{
for ( int i=a ; i>0; i--) {
if( a%i==0 && b%i==0) {
return i ;
}}}



int main (){
int a,b;
cin>>a>>b;
cout << x(a,b) ; }

باستخدام الدوال ايجاد القاسم المشترك الاكبر لعددين ..
#include <iostream>
using namespace std;
void p(int n)
{
int h=0 , f=1;
for ( int i=1 ; i<=n ; i++ ) {
h=0;
for ( int j=2 ; j<=i ; j++ )
if(i%j==0)
h+=f;
if(h==1)
cout << i << " " ; }}
int main () {
int n;
cin >> n;
p(n) ; }

باستخدام الدوال ايجاد الاعداد الاوليه الى n ..
#include <iostream>
using namespace std;

int x(int n)
{
int c=0;
int m;
while(n!=0) {
m=n%10;
n=n/10;
c++; }

return c; }



int main () {
int n;
cin >> n;

cout << x(n); }

باستخدام الدوال ايجاد كم عدد الخانه المدخله من قبل المستخدم ..
#include <iostream>
using namespace std;
void prime(int x)
{
string p= " the number prime";
for ( int i=2 ; i< x ; i++ )
if ( x%i ==0) {
p=" not ";
break ; }
cout << p ; }



int main () {
int x;
cin>> x;
prime(x) ; }

باستخدام الدوال فحص العدد المدخل من قبل المستخدم أإأذأإأ كان اولي او لاا ..
#include <iostream>
using namespace std;
void p(int x)
{
for ( int i=1 ; i< x ; i++ ) {
if ( x%i == 0)
cout << i << " "; }}



int main () {
int x;
cin >> x;
p(x); }

باستخدام الدوال ايجاد قواسم العدد المدخل من قبل المستخدم..
#include <iostream>
using namespace std;

int odd(int a[][3]) {
int sum=0;
for ( int i=0 ; i< 3 ; i++ ){
for ( int j=0 ; j< 3 ; j++ ) {
if ( a[i][j] %2== 1) {
sum+=a[i][j]; }}}
return sum ; }

int main () {
int a[3][3];
for ( int i=0 ; i< 3 ; i++ )
for ( int j=0 ; j< 3 ; j++ )
cin>>a[i][j];
cout << odd(a); }


باستخدام الدوال ايجاد مجموع الاعداد الفرديه في مصفوفه 3*3 ..
#include <iostream>
using namespace std;
int main () {
int a[7]={1,6,8,3,10,4,33 };
int b[7];
int x;
cin >> x;
for ( int i=0 ; i< 7 ; i++ ) {
if ( i+x>=7){
b[i+x-7] = a[i]; }
else {
b[i+x]=a[i]; }}
for ( int i=0 ; i< 7; i++ )
cout << b[i] << " " ; }


الازاحه بمقدار 3 للمصفوفه ..
int f( int a)
{
if ( a>0)
return (a*f(a-1));
else
return 1;
}
int main () {
int n;
cin >> n;
cout << f(n) ; }


باستخدام الدوال ايجاد مضروب العدد المدخل باستخدام الاستدعاء الذاتي..
int power( int x, int y) {
if(y>0)
return (x*power(x,y-1));
else
return 1; }
int main (){
int n;
int m;
cin >>n;
cin>>m;
cout <<power(n,m) ;}

باستخدام الدوال ايجاد القوى لعددين مدخلين باستخدام الاستدعاء الذاتي ..
int a[4][4];
int sum = 0;
for (int i = 0; i < 4; i++)
for (int j = 0; j < 4; j++)
cin >> a[i][j];
for (int i = 0; i < 4; i++)
{
for (int j = 0; j < 4; j++)
{
if ((i == j) || ( i+j==4-1))
{
sum += a[i][j];
}}}




cout << sum;

ايجاد مجموع عنااصر القطر الرئيسي والثانوي لمصفوفه 4*4