Zaitov Abdumaruf 130-20 guruh talabasi 1-topshiriq



Download 309,85 Kb.
Sana30.04.2022
Hajmi309,85 Kb.
#600381
Bog'liq
structura


Zaitov Abdumaruf 130-20 guruh talabasi


4.1-topshiriq
1-masala
def yigindi(a,b):
return (a+b)
natija=0
n=int(input("sonlar soni -->> "))
sonlar=[35,8,18,3,22]
for i in range(n):
sonlar[i].add(int(input()))
k=int(input("2 tasi yig'indisi nechaga teng bo'lsin = "))
for i in range(n):
j=i
for j in range(n):
if (yigindi(sonlar[i],sonlar[j]==k)):
natija=1
break
else:
natija=0
if (natija==1):
print("TRUE")
else:
print("FALSE")
2 masala
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
public static int yig(int a, int b, int c, int d)
{
return (a + b + c + d);
}
static void Main(string[] args)
{
int sanoq=0;
Console.Write("saylanishlar soni = "); int n = Convert.ToInt32(Console.ReadLine());
string[] Votes = new string[n];
Console.WriteLine("'candidate_id, voter_id' shu uslda kiriting");
for (int i = 0; i < n; i++)
{
Votes[i] = Console.ReadLine();
}
for (int i = 0; i < n; i++)
{
for (int j = i+1; j < n; j++)
{
if (Votes[i] == Votes[j]) sanoq++;
}
}
Console.WriteLine(sanoq);
if (!(sanoq == 0)) Console.WriteLine("True");
else Console.WriteLine("False");
Console.ReadKey(true);
}
}
}
3 masala
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
public static int yig(int a, int b, int c, int d)
{
return (a + b + c + d);
}
static void Main(string[] args)
{
string sonlar = "";
string natijalar="";
int sanoq=0;
Console.WriteLine("sonlar ro'yharlarni to'ldiring ixtiyoriy");
Console.WriteLine("har bir ruyhat elemetlari 1 satrda kiriting");
Console.WriteLine("A ruyhat elemetlarini kiriting");
sonlar = Console.ReadLine(); List a = new List(sonlar.Split(' '));
Console.WriteLine("B ruyhat elemetlarini kiriting");
sonlar = Console.ReadLine(); List b = new List(sonlar.Split(' '));
Console.WriteLine("C ruyhat elemetlarini kiriting");
sonlar = Console.ReadLine(); List c = new List(sonlar.Split(' '));
Console.WriteLine("D ruyhat elemetlarini kiriting");
sonlar = Console.ReadLine(); List d = new List(sonlar.Split(' '));
Console.Write("maqsadni kiriting = "); int maq = Convert.ToInt32(Console.ReadLine());
foreach (var i in a)
{
foreach (var j in b)
{
foreach (var k in c)
{
foreach (var l in d)
{
var natija = yig(Convert.ToInt32(i), Convert.ToInt32(j), Convert.ToInt32(k), Convert.ToInt32(l));
if (natija==maq)
{
natijalar+="["+i+", "+j+", "+k+", "+l+"]\n";
sanoq++;
}
}
}
}
}
Console.WriteLine("Dastur natijasi = "+sanoq);
Console.WriteLine("tushunish uchun\n"+natijalar);
Console.ReadKey(true);
}
}}
4 topshiriqit

1 – masala


import java.util.Scanner;

public class test {


public static void main(String[] args) {
int n;
Scanner kirit = new Scanner(System.in);
System.out.print("list uzunligini kiriting >> ");
n = kirit.nextInt();

int[] list = new int[n];

for(int i=0; iSystem.out.print("list["+(i+1)+"] >> ");
list[i] = kirit.nextInt();
}
boolean holat = false;
int l=0;
for (int i = 0; i < n-1; i++) {
if(!(list[i]holat = true;
break;
}
}

if(holat){


System.out.println("Yolg'on");
}else{
System.out.println("Rost");
}
}
}

2 – masala

import java.util.Scanner;

public class test {


public static void main(String[] args) {
int n;
Scanner kirit = new Scanner(System.in);
System.out.print("list uzunligini kiriting >> ");
n = kirit.nextInt();

String[] list = new String[n];

for(int i=0; iSystem.out.print("list["+(i+1)+"] >> ");
list[i] = kirit.next();
}

int l=0;
boolean hol=false;


for (int i = 0; i < n; i++) {
for (int j = i+1; j < n; j++)
{
if (list[i].equals(list[j])){
list[j]=" ";
hol=true;
}
}
if (hol)list[i]=" ";
hol=false;
}

for (int i = 0; i < list.length; i++) {


if(!list[i].equals(" ")){
System.out.println(list[i]);
}
}
}
}

3 masala

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
public static int yig(int a, int b, int c, int d)
{
return (a + b + c + d);
}
static void Main(string[] args)
{
Console.Write(""); string manba = Console.ReadLine();
double s = 0;
List ikkilik = new List(manba.Split(' '));
for (int i = ikkilik.Count-1,j=0; i >= 0; j++,i--)
{
s += Convert.ToDouble(ikkilik[i])*Math.Pow(2, j);
}
Console.WriteLine("Dastur natijasi = " + s);
Console.ReadKey(true);
}
}
}

4 misol



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.Write(""); string manba = Console.ReadLine();
List tuplam = new List(manba.Split(' '));
Console.Write("maqsad = "); string maqsad = Console.ReadLine();
foreach (var indek in tuplam)
{
if (!(indek == maqsad))
{
Console.Write(indek + " ");
}
}
Console.ReadKey(true);
}
}
}

5 topshiriqt



6 topshiriqt





Download 309,85 Kb.

Do'stlaringiz bilan baham:




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish