Topshiriq -1


Download 157.8 Kb.
Sana28.12.2022
Hajmi157.8 Kb.
#1020781
Bog'liq
Dasturlash-3


Muhammad al-Xorazmiy nomidagi


Toshkent axborot texnologiyalari universiteti dasturiy injiniring fakulteti 316-22- guruh talabasi Rashidov Azamatning dasturlash I fanidan yozgan amaliyot ishi-3

VARIANT-10;

Topshiriq -1 :

Dastur kodi:


#include
using namespace std;
int main(){
int j=8;
double s=0;
int a[j]={1,17,2,4,-5,0,7,8};
cout<<"Massiv elementlari :";
for(int i=0;icout<}
cout<<"\nMassivda nolga teng elementgacha bo'lgan elementlar yig'idisi :";
for(int i=0;iif(a[i]!=0){
s+=a[i];
}
else
break;
}cout<return 0;}

Dastur natijasi :



Topshiriq -2:


Dastur kodi:


#include
#include
using namespace std;
void arifmetik_geometrik(double a,double b){
double s,p;
s=(a+b)/2;
p=sqrt(a*b);
cout< cout<<"O'rta arifmetrigi :"< cout<<"O'rta geometrigi :"<
}
int main(){
double a,b,c,d;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
cout<<"c=";cin>>c;
cout<<"d=";cin>>d;
arifmetik_geometrik(a,b);
arifmetik_geometrik(a,c);
arifmetik_geometrik(a,d);
return 0;}

Dastur natijasi :


Topshiriq -3:



Dastur kodi:


#include
#include
#include
using namespace std;
int main(){
srand(time(0));
int m;
int n;
cout<<"M=";cin>>m;
cout<<"N=";cin>>n;
int a[m][n];
cout<<"\n["<for(int i=0;ifor(int j=0;ja[i][j]=rand()%89+10;
cout<}
cout<}
cout<<"\nMatritsani juft satrdagi elementlari :\n";
for(int i=0;ifor(int j=0;jcout<}
cout<}
return 0;}
Dastur natijasi :

Download 157.8 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling