Мазмұнға өту
dan_ntu

Данияр Мырзаканов

@dan_ntu

Сайтта 2010 ж. 29 наурызКазахстан, Алматы

Қазақстан халқы үшін қызмет жасаймын

рейтинг

100

жазбалар

173

пікірлер

73

тіркелуші

96

жазылымдар

7

Екі бірлік массивтер бойынша үшінші массив құрастырылады, құрамында басында бірінші массивтің элементтері аяғында екінші массивтің элементтері.

import java.util.Scanner; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author DMyrzaka */ public class Esep1 { public static void main(String[] args){ double[] a = new double[100]; double[] b = new double[100]; double[] c = new double[100]; int i; // Длина первого масиссива Scanner in = new Scanner(System.in); System.out.println("Введите длину первого массива ->"); int n1 = in.nextInt(); for (i=0;i<n1;i++){ System.out.print("a["+i+"]="); a[i]=in.nextDouble(); } //Длина второго массива System.out.println("Введите длину второго массива ->"); int n2 = in.nextInt(); for (i=0;i<n2;i++){ System.out.print("b["+i+"]="); b[i]=in.nextDouble();…

0
0
977

Нақты А=(a1,a2,...,a9) векторының бірінші оң компонентінен кейінгілерін 0,5 кемітіңіз. Бастапқы мәндер: -7,4; 0; -21; 4,6; 3; -2,6; 2,5; -1,3; 0,4

import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author DMyrzaka
*/
public class Esep1 {
public static void main(String[] args){
double[] a = new double[100];
int i,k=0;
Scanner in = new Scanner(System.in);
System.out.println("Введите длину массива ->");
int n = in.nextInt();
for (i=0;i<n;i++){
System.out.print("a["+i+"]=");
a[i]=in.nextDouble();
}
for (i=0;i<n;i++){
if(a[i]>0){
k=i;
break;
}
}
System.out.println("k="+k);
for (i=k+1;i<n;i++){
a[i]-=0.5;
}
for (i=0;i<n;i++){
System.out.print("a["+i+"]="+a[i]+" ");
}
}
}
1
0
286

A(10),В(10) екі массиві берілген. A(10),В(10) массивтеріндегі бірінші нөл элементіне дейінгі элементтерді 0,5 санына ауыстыру.

// Example program #include &lt;iostream&gt; #include &lt;string&gt; using namespace std; int main() { double A[1000]; double B[1000]; int k1,k2,n,i; cout&lt;&lt;"Vvedite n-&gt;"; cin&gt;&gt;n; cout&lt;&lt;"Massivti engizu A["&lt;&lt;n&lt;&lt;"]:"&lt;&lt;endl; for (i=0;i&lt;n;i++){ cout&lt;&lt;"A["&lt;&lt;i&lt;&lt;"]="; cin&gt;&gt;A[i]; } for (i=0;i&lt;n;i++){ if (A[i]==0) { k1=i; break; } } for (i=0;i&lt;k1;i++){ A[i]=0.5; } // B maasive cout&lt;&lt;"Massivti engizu B["&lt;&lt;n&lt;&lt;"]:"&lt;&lt;endl; for (i=0;i&lt;n;i++){ cout&lt;&lt;"B["&lt;&lt;i&lt;&lt;"]="; cin&gt;&gt;B[i]; } for (i=0;i&lt;n;i++){ if (B[i]==0) { k2=i; break; } } for (i=0;i&lt;k2;i++){ B[i]=0.5; } cout&lt;&lt;"Massive A "&lt;&lt;endl; for (i=0;i&lt;n;i++){ cout&lt;&lt;"A["&lt;&lt;i&lt;&lt;"]="&lt;&lt;A[i]&lt;&lt;" "…

0
0
598

бүтін сандар жиымының 5-ке бөлінетін элементтерінің санын табу керек dev c++-та

#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int y[1000];
int i,n,k=0;
cout<<"Massivtin uzindigi n->:"<<endl;
cin>>n;
cout<<"Massivti engizu y["<<n<<"]:"<<endl;
for (i=0;i<n;i++){
cout<<"y["<<i<<"]=";
cin>>y[i];
}
for (i=0;i<n;i++){
if (y[i] % 5 ==0){
k++;
}
}
cout<<"\n Ondelgen massiv"<<endl;
cout<<"5 ke bolinetin sandar sani "<<k;
getch();
return 0;
}
0
0
1307

Массивтегі 4тен үлкен сандардын ішіндегі ең кішісін табу керек

#include <cstdlib>
#include <iostream>

#include <iostream>
using namespace std;

int main(int argc, char* argv[]) 

int a[100]; 
int b[100] 
int count,k=0,min; 

cout « "n engiz: "; 
cin « count; 

for (int i=0;i<count;i++){ 
cout«"a["«i«"]="; 
cin»a[i]; 

for (int i=0;i<count;i++){ 
if (a[i]>4) { b[k]=a[i]; k++;} 

min=b[0]; 
for(int i=1;i<k;i++) 
if(b[i]<min) min=b[i]; 
cout«"4 ten ulken sandar ishindegi minimum = "«min«endl; 

system("pause"); 
return 0; 
}

0
1
806

Массивтің барлық нольдік элементтерін массив соңына қоя отырып, оны түрлендіріңіз.

import java.util.Scanner;

public class Esep2 {
public static void main(String args[]){
int n;
int temp;
int a[]= new int[100];
Scanner sc = new Scanner(System.in);
System.out.println("Vvedite n->");
n=sc.nextInt();

System.out.println ("Vvedite massive a: ");
for (int i = 0; i< n; i++) {
a[i] = sc.nextInt();
}
shiftZeroToEnd(a,n); 

for (int i = 0; i< n; i++) {
System.out.print("a["+i+"]="+a[i]+" ");
}
}
static void shiftZeroToEnd(int[] arr,int n) {
for (int i = n-1; i >= 0; i--) {
if (arr[i] == 0) {
swapAndShift(arr,i,n);
}
}
}

static void swapAndShift(int[] arr, int i, int n) {
int tmp = arr[i];
for (int j = i; j < n - 1; j++) {
arr[j] = arr[j + 1];
}
arr[n-1] = tmp;

}
}

0
2
482

А әрпімен аяқталатын сөздерді шығар

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
int main()
{
int i;
char inputStr[256];
char *word;
printf("Vvedite text:\n");
scanf("%[^\n]", inputStr);
scanf("%*[^\n]");
scanf("%*c");
word = strtok(inputStr, " ");
printf("A arpimen ayaktalatin sozder:\n");
while (word != NULL)
{
if ((word[strlen(word) - 1] == 'A') ||
(word[strlen(word) - 1] == 'a') )
printf("%s\n", word);
word = strtok(NULL, " ");
}
getch();
return 0;
}
0
0
781

Екі (х1,ү1) және В(x2,y2) нүктелерінің координаталары бойынша ара қашықтығын анықтау функциясын тап!

#include<conio.h>
#include<stdio.h>
#include<math.h>
float ara(float X1,float X2,float Y1, float Y2){
float eki;
eki=sqrt(pow(X2-X1,2)+pow(Y2-Y1,2));
return eki;
}
main(){
float X1,X2,Y1,Y2;
printf("X1 manin engiz->");
scanf("%f",&X1);
printf("X2 manin engiz->");
scanf("%f",&X2);
printf("Y1 manin engiz->");
scanf("%f",&Y1);
printf("Y2 manin engiz->");
scanf("%f",&Y2);
printf("Eki nuktenun ara kashiktigi = %3.2f",ara(X1,X2,Y1,Y2));
getch();
}
0
0
2134

Х жолдың қатарында кездесетін «а» символдарын санап, оларды «б» символымен ауыстыру функциясын тап!

#include <iostream.h>
#include <string.h>
#include <conio.h>
int austyr(char* stroka){
int chislo=0;
int strl;
strl=strlen(stroka);
for (int i=0;i<strl;i++){
if(stroka[i]=='a'){
chislo++;
stroka[i]='b';
}
}
return chislo;
}
int main(){
char stroka[512];
cin.getline(stroka,sizeof(stroka),'.'); // òî÷êà êîþ êåðåê ìàòèí åíãèçãåíñîí
printf("a sani = %d\n",austyr(stroka));
printf("stroka= %s\n",stroka);
getch();
return 0;
}
0
0
583