Neler yeni
MEGAForum - Teknoloji Forumu

Forum içeriğine ve tüm hizmetlerimize erişim sağlamak için foruma kayıt olmalı yada giriş yapmalısınız. Forum üye olmak tamamen ücretsizdir.

Konsol'dan Tek Satırlık Komutla "Linux 'da 1'den 10^n Aralığındaki Sayıları Toplama/Çıkartma/Çarpma/Bölme"

TRWE_2012

لِيَغْفِرَ لَكَ اللّٰهُ مَا تَقَدَّمَ مِنْ ذَنْبِك
Moderatör
Konum
BERTUNA
  • Üyelik Tarihi
    2 Haz 2020
  • Mesajlar
    5,275
  • MFC Puanı
    15,970
Kullanılanacak Komut Yapısı:

Kod:
seq 10'n| paste -sdA | bc -l

Yukarıdaki çıktı da

10^n : 10'un n. kuveti.....
A: Cebirsel İşaretleme

+ : Toplama
- : Çıkarma
* :Çarpma
/ : Bölme

ÖRNEK ÇIKTILAR:

10^n : 1000 olsun

1 ile 1000 arasındaki sayıların ;

TOPLAMA:
Kod:
seq 1000| paste -sd+ | bc -l = sonuç :   500500

ÇIKARTMA:
Kod:
seq 1000| paste -sd- | bc -l = sonuç : -500498

BÖLME:
Kod:
seq 1000| paste -sd/ | bc -l = sonuç : 0

ÇARPMA:
Kod:
seq 1000| paste -sd* | bc -l = sonuç :   40238726007709377354370243392300398571937486421071463254379991042993\
85123986290205920442084869694048004799886101971960586316668729948085\
58901323829669944590997424504087073759918823627727188732519779505950\
99527612087497546249704360141827809464649629105639388743788648733711\
91810458257836478499770124766328898359557354325131853239584630755574\
09114262417474349347553428646576611667797396668820291207379143853719\
58824980812686783837455973174613608537953452422158659320192809087829\
73084313928444032812315586110369768013573042161687476096758713483120\
25478589320767169132448426236131412508780208000261683151027341827977\
70478463586817016436502415369139828126481021309276124489635992870511\
49649754199093422215668325720808213331861168115536158365469840467089\
75602900950537616475847728421889679646244945160765353408198901385442\
48798495995331910172335555660213945039973628075013783761530712776192\
68490343526252000158885351473316117021039681759215109077880193931781\
14194545257223865541461062892187960223838971476088506276862967146674\
69756291123408243920816015378088989396451826324367161676217916890977\
99119037540312746222899880051954444142820121873617459926429565817466\
28302955570299024324153181617210465832036786906117260158783520751516\
28422554026517048330422614397428693306169089796848259012545832716822\
64580665267699586526822728070757813918581788896522081643483448259932\
66043367660176999612831860788386150279465955131156552036093988180612\
13855860030143569452722420634463179746059468257310379008402443243846\
56572450144028218852524709351906209290231364932734975655139587205596\
54228749774011413346962715422845862377387538230483865688976461927383\
81490014076731044664025989949022222176590433990188601856652648506179\
97023561938970178600408118897299183110211712298459016419210688843871\
21855646124960798722908519296819372388642614839657382291123125024186\
64935314397013742853192664987533721894069428143411852015801412334482\
80150513996942901534830776445690990731524332782882698646027898643211\
39083506217095002597389863554277196742822248757586765752344220207573\
63056949882508796892816275384886339690995982628095612145099487170124\
45164612603790293091208890869420285106401821543994571568059418727489\
98094254742173582401063677404595741785160829230135358081840096996372\
52423056085590370062427124341690900415369010593398383577793941097002\
77534720000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000\
00000000000000000000000000000000000000000000000000000000000000000000\
0000000000000000000000000000000000000000000000000000
 
Üst Alt