尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
PROGRAMMING
IN
LUA
(FUNCTIONS WITH STRING AND
ARRAY)
INDEX
Program to accept the string and count number of vowels in it.
Program to accept the string and count number words whose first letter is vowel.
Program to accept the string and check it’s a palindrome or not
Program to accept the number from user and search it in an array of 10 numbers using linear search.
Program to accept the numbers in an array unsorted order and display it in selection sort.
Program to swap first element with last, second to second last and so on (reversing elements)
Program to create a function name swap2best() with array as a parameter and swap all the even
index value.
Program to print the left diagonal from a 2D array
Program to swap the first row of the array with the last row of the array
Program to print the lower half of the 2d array.
Program to accept the string and count number of vowels in it.
function vowelcount(sent)
k=string.len(sent)
x=1
count=0
while(x<=k)
do
ch=string.sub(sent,x,x)
if(ch=='a' or ch=='e' or ch=='i' or ch=='u' or ch=='o')
then
count=count+1
end
x=x+1
end
print("no of vowels are = "..count)
end
vowelcount("my first program of vowel")
------------------output---------------------------
no of vowels are = 6
Program to accept the string and count number words whose first letter is vowel.
function vowelcount(sent)
k=string.len(sent)
x=1
count=0
flag=1
while(x<=k)
do
ch=string.sub(sent,x,x)
if(flag==1)
then
ch=string.sub(sent,x,x)
if(ch=='a' or ch=='e' or ch=='i' or ch=='u' or ch=='o')
then
count=count+1
flag=0
end
end
if(ch==' ')
then
x=x+1
ch=string.sub(sent,x,x)
if(ch=='a' or ch=='e' or ch=='i' or ch=='u' or ch=='o')
then
count=count+1
end
end
x=x+1
end
print("no of vowels are = "..count)
end
vowelcount("its my irst program of vowel word in our")
-------------------output-------------------
no of vowels are = 5
Program to accept the string and check it’s a palindrome or not
function checkpal(nm)
k=string.len(nm)
for x=1,math.floor(string.len(nm)/2),1
do
if(string.sub(nm,x,x) == string.sub(nm,k,k))
then
flag=1
else
flag=-1
break
end
k=k-1
end
return flag
end
nm=io.read()
t=checkpal(nm)
if(t==1)
then
print("Its a pal")
else
print("Its not a pal")
end
--------------output----------------
madam
Its a pal
Program to accept the number from user and search it in an array of 10 numbers using linear search.
no={5,10,25,8,6,53,4,9,12,14}
x=1
pos=-1
print("enter the number to search")
search=tonumber(io.read())
while(x<=10)
do
if(no[x]==search)
then
pos=x
break
end
x=x+1
end
if(pos<0)
then
print("no not found")
else
print("no found at "..pos)
end
----------------------output----------------------
enter the number to search
6
no found at 5
Program to accept the numbers in an array unsorted order and display it in selection sort.
no={5,10,25,8,6,53,4,9,12,14}
x=1
tmp=0
print("before sorting")
while(x<=10)
do
io.write(no[x].." ")
x=x+1
end
print()
x=1
while(x<=10)
do
y=x+1
while(y<=10)
do
if(no[x]>no[y])
then
tmp=no[x]
no[x]=no[y]
no[y]=tmp
end
y=y+1
end
x=x+1
end
print("After sorting")
x=1
while(x<=10)
do
io.write(no[x].." ")
x=x+1
end
------------------output----------------------
before sorting
5 10 25 8 6 53 4 9 12 14
After sorting
4 5 6 8 9 10 12 14 25 53
program to swap first element with last, second to second last and so on (reversing elements)
no={5,10,25,8,6,53,4,9,12,14}
x=1
tmp=0
print("Before........")
while(x<=10)
do
io.write(no[x].." ")
x=x+1
end
x=1
print()
y=10
for x=1,math.floor(10/2)
do
tmp=no[x]
no[x]=no[y]
no[y]=tmp
y=y-1
end
print("nAfter........")
x=1
while(x<=10)
do
io.write(no[x].." ")
x=x+1
end
------------------output-------------------------
Before........
5 10 25 8 6 53 4 9 12 14
After........
14 12 9 4 53 6 8 25 10 5
Program to create a function name swap2best() with array as a parameter and swap all the even index value.
function swap2best(no)
x=1
tmp=0
print("Before........")
while(x<=10)
do
io.write(no[x].." ")
x=x+1
end
x=1
print()
for x=1,10,2
do
tmp=no[x]
no[x]=no[x+1]
no[x+1]=tmp
end
print("nAfter........")
x=1
while(x<=10)
do
io.write(no[x].." ")
x=x+1
end
end
no={10,20,30,40,50,60,70,80,90,110}
swap2best(no)
-------------------output--------------------
Before........
10 20 30 40 50 60 70 80 90 110
After........
20 10 40 30 60 50 80 70 110 90
Program to print the left diagonal from a 2D array
function display(no,N)
x=1
tmp=0
print("Before........")
while(x<=N)
do
y=1
while(y<=N)
do
io.write(no[x][y].."t")
y=y+1
end
print()
x=x+1
end
end
function displayleftdiagonal(no,N)
for x=1,N
do
print(no[x][x])
end
end
no={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}}
display(no,4)
displayleftdiagonal(no,4)
------------------output------------------
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
1
6
11
16
Program to swap the first row of the array with the last row of the array
function display(no,R,C)
x=1
tmp=0
print(".....................")
while(x<=R)
do
y=1
while(y<=C)
do
io.write(no[x][y].."t")
y=y+1
end
print()
x=x+1
end
end
function swapfirstwithlastR(no,R,C)
last=R
for x=1,C
do
tmp=no[1][x]
no[1][x]=no[last][x]
no[last][x]=tmp
end
end
no={{1,2,3,4,1,5,7},{5,6,7,8,8,9,4},{9,10,11,12,11,23,5},{13,14,15,16,1,2,8}}
display(no,4,7)
swapfirstwithlastR(no,4,7)
display(no,4,7)
------------------output--------------------
.....................
1 2 3 4 1 5 7
5 6 7 8 8 9 4
9 10 11 12 11 23 5
13 14 15 16 1 2 8
.....................
13 14 15 16 1 2 8
5 6 7 8 8 9 4
9 10 11 12 11 23 5
1 2 3 4 1 5 7
Program to print the lower half of the 2d array.
function display(no,R,C)
x=1
tmp=0
print(".....................")
while(x<=R)
do
y=1
while(y<=C)
do
io.write(no[x][y].."t")
y=y+1
end
print()
x=x+1
end
end
function lowerhalf(no,R,C)
for x=1,R
do
for y=1,C
do
if(x>=y)
then
io.write(no[x][y].." ")
end
end
print()
end
end
no={{1,2,3,4,1,5,7},{5,6,7,8,8,9,4},{9,10,11,12,11,23,5},{13,14,15,16,1,2,8}}
display(no,4,7)
lowerhalf(no,4,7)
-----------------output-------------------------
1 2 3 4 1 5 7
5 6 7 8 8 9 4
9 10 11 12 11 23 5
13 14 15 16 1 2 8
1
5 6
9 10 11
13 14 15 16
Programming in lua STRING AND ARRAY

More Related Content

What's hot

Python programming -Tuple and Set Data type
Python programming -Tuple and Set Data typePython programming -Tuple and Set Data type
Python programming -Tuple and Set Data type
Megha V
 
Kotlin collections
Kotlin collectionsKotlin collections
Kotlin collections
Myeongin Woo
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014
Baruch Sadogursky
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
Aleksandar Prokopec
 
ScalaBlitz
ScalaBlitzScalaBlitz
Python легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачиPython легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачи
Maxim Kulsha
 
Iterative1
Iterative1Iterative1
Iterative1
Md. Mujahid Islam
 
ScalaMeter 2014
ScalaMeter 2014ScalaMeter 2014
ScalaMeter 2014
Aleksandar Prokopec
 
Itroroduction to R language
Itroroduction to R languageItroroduction to R language
Itroroduction to R language
chhabria-nitesh
 
Scala collections
Scala collectionsScala collections
Scala collections
Inphina Technologies
 
Scala Parallel Collections
Scala Parallel CollectionsScala Parallel Collections
Scala Parallel Collections
Aleksandar Prokopec
 
Functional Programming in Swift
Functional Programming in SwiftFunctional Programming in Swift
Functional Programming in Swift
Saugat Gautam
 
Kotlin standard
Kotlin standardKotlin standard
Kotlin standard
Myeongin Woo
 
Python programming : List and tuples
Python programming : List and tuplesPython programming : List and tuples
Python programming : List and tuples
Emertxe Information Technologies Pvt Ltd
 
Print input-presentation
Print input-presentationPrint input-presentation
Print input-presentation
Martin McBride
 
Scala Functional Patterns
Scala Functional PatternsScala Functional Patterns
Scala Functional Patterns
league
 
Scala. Introduction to FP. Monads
Scala. Introduction to FP. MonadsScala. Introduction to FP. Monads
Scala. Introduction to FP. Monads
Kirill Kozlov
 
The Ring programming language version 1.2 book - Part 12 of 84
The Ring programming language version 1.2 book - Part 12 of 84The Ring programming language version 1.2 book - Part 12 of 84
The Ring programming language version 1.2 book - Part 12 of 84
Mahmoud Samir Fayed
 
Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge
O T
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
Adam Dudczak
 

What's hot (20)

Python programming -Tuple and Set Data type
Python programming -Tuple and Set Data typePython programming -Tuple and Set Data type
Python programming -Tuple and Set Data type
 
Kotlin collections
Kotlin collectionsKotlin collections
Kotlin collections
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
ScalaBlitz
ScalaBlitzScalaBlitz
ScalaBlitz
 
Python легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачиPython легко и просто. Красиво решаем повседневные задачи
Python легко и просто. Красиво решаем повседневные задачи
 
Iterative1
Iterative1Iterative1
Iterative1
 
ScalaMeter 2014
ScalaMeter 2014ScalaMeter 2014
ScalaMeter 2014
 
Itroroduction to R language
Itroroduction to R languageItroroduction to R language
Itroroduction to R language
 
Scala collections
Scala collectionsScala collections
Scala collections
 
Scala Parallel Collections
Scala Parallel CollectionsScala Parallel Collections
Scala Parallel Collections
 
Functional Programming in Swift
Functional Programming in SwiftFunctional Programming in Swift
Functional Programming in Swift
 
Kotlin standard
Kotlin standardKotlin standard
Kotlin standard
 
Python programming : List and tuples
Python programming : List and tuplesPython programming : List and tuples
Python programming : List and tuples
 
Print input-presentation
Print input-presentationPrint input-presentation
Print input-presentation
 
Scala Functional Patterns
Scala Functional PatternsScala Functional Patterns
Scala Functional Patterns
 
Scala. Introduction to FP. Monads
Scala. Introduction to FP. MonadsScala. Introduction to FP. Monads
Scala. Introduction to FP. Monads
 
The Ring programming language version 1.2 book - Part 12 of 84
The Ring programming language version 1.2 book - Part 12 of 84The Ring programming language version 1.2 book - Part 12 of 84
The Ring programming language version 1.2 book - Part 12 of 84
 
Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge Beginners python cheat sheet - Basic knowledge
Beginners python cheat sheet - Basic knowledge
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
 

Similar to Programming in lua STRING AND ARRAY

Introduction to R programming
Introduction to R programmingIntroduction to R programming
Introduction to R programming
Alberto Labarga
 
Monadologie
MonadologieMonadologie
Monadologie
league
 
R Cheat Sheet for Data Analysts and Statisticians.pdf
R Cheat Sheet for Data Analysts and Statisticians.pdfR Cheat Sheet for Data Analysts and Statisticians.pdf
R Cheat Sheet for Data Analysts and Statisticians.pdf
Timothy McBush Hiele
 
A brief introduction to apply functions
A brief introduction to apply functionsA brief introduction to apply functions
A brief introduction to apply functions
NIKET CHAURASIA
 
BUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdfBUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdf
karthikaparthasarath
 
Rcommands-for those who interested in R.
Rcommands-for those who interested in R.Rcommands-for those who interested in R.
Rcommands-for those who interested in R.
Dr. Volkan OBAN
 
Python : Functions
Python : FunctionsPython : Functions
Implement the following sorting algorithms Bubble Sort Insertion S.pdf
Implement the following sorting algorithms  Bubble Sort  Insertion S.pdfImplement the following sorting algorithms  Bubble Sort  Insertion S.pdf
Implement the following sorting algorithms Bubble Sort Insertion S.pdf
kesav24
 
Matlab cheatsheet
Matlab cheatsheetMatlab cheatsheet
Matlab cheatsheet
lokeshkumer
 
Python Lecture 11
Python Lecture 11Python Lecture 11
Python Lecture 11
Inzamam Baig
 
3 kotlin vs. java- what kotlin has that java does not
3  kotlin vs. java- what kotlin has that java does not3  kotlin vs. java- what kotlin has that java does not
3 kotlin vs. java- what kotlin has that java does not
Sergey Bandysik
 
Fp in scala part 2
Fp in scala part 2Fp in scala part 2
Fp in scala part 2
Hang Zhao
 
The Ring programming language version 1.9 book - Part 31 of 210
The Ring programming language version 1.9 book - Part 31 of 210The Ring programming language version 1.9 book - Part 31 of 210
The Ring programming language version 1.9 book - Part 31 of 210
Mahmoud Samir Fayed
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdf
srxerox
 
ifelse.pptx
ifelse.pptxifelse.pptx
ifelse.pptx
JananiJ19
 
Python 04-ifelse-return-input-strings.pptx
Python 04-ifelse-return-input-strings.pptxPython 04-ifelse-return-input-strings.pptx
Python 04-ifelse-return-input-strings.pptx
TseChris
 
fds Practicle 1to 6 program.pdf
fds Practicle 1to 6 program.pdffds Practicle 1to 6 program.pdf
fds Practicle 1to 6 program.pdf
GaneshPawar819187
 
世预赛买球-世预赛买球竞彩平台-世预赛买球竞猜平台|【​网址​🎉ac123.net🎉​】
世预赛买球-世预赛买球竞彩平台-世预赛买球竞猜平台|【​网址​🎉ac123.net🎉​】世预赛买球-世预赛买球竞彩平台-世预赛买球竞猜平台|【​网址​🎉ac123.net🎉​】
世预赛买球-世预赛买球竞彩平台-世预赛买球竞猜平台|【​网址​🎉ac123.net🎉​】
hanniaarias53
 
美洲杯买球-美洲杯买球怎么押注-美洲杯买球押注怎么玩|【​网址​🎉ac99.net🎉​】
美洲杯买球-美洲杯买球怎么押注-美洲杯买球押注怎么玩|【​网址​🎉ac99.net🎉​】美洲杯买球-美洲杯买球怎么押注-美洲杯买球押注怎么玩|【​网址​🎉ac99.net🎉​】
美洲杯买球-美洲杯买球怎么押注-美洲杯买球押注怎么玩|【​网址​🎉ac99.net🎉​】
kokoparmod677
 
欧洲杯足彩-欧洲杯足彩线上体育买球-欧洲杯足彩买球推荐网站|【​网址​🎉ac55.net🎉​】
欧洲杯足彩-欧洲杯足彩线上体育买球-欧洲杯足彩买球推荐网站|【​网址​🎉ac55.net🎉​】欧洲杯足彩-欧洲杯足彩线上体育买球-欧洲杯足彩买球推荐网站|【​网址​🎉ac55.net🎉​】
欧洲杯足彩-欧洲杯足彩线上体育买球-欧洲杯足彩买球推荐网站|【​网址​🎉ac55.net🎉​】
brunasordi905
 

Similar to Programming in lua STRING AND ARRAY (20)

Introduction to R programming
Introduction to R programmingIntroduction to R programming
Introduction to R programming
 
Monadologie
MonadologieMonadologie
Monadologie
 
R Cheat Sheet for Data Analysts and Statisticians.pdf
R Cheat Sheet for Data Analysts and Statisticians.pdfR Cheat Sheet for Data Analysts and Statisticians.pdf
R Cheat Sheet for Data Analysts and Statisticians.pdf
 
A brief introduction to apply functions
A brief introduction to apply functionsA brief introduction to apply functions
A brief introduction to apply functions
 
BUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdfBUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdf
 
Rcommands-for those who interested in R.
Rcommands-for those who interested in R.Rcommands-for those who interested in R.
Rcommands-for those who interested in R.
 
Python : Functions
Python : FunctionsPython : Functions
Python : Functions
 
Implement the following sorting algorithms Bubble Sort Insertion S.pdf
Implement the following sorting algorithms  Bubble Sort  Insertion S.pdfImplement the following sorting algorithms  Bubble Sort  Insertion S.pdf
Implement the following sorting algorithms Bubble Sort Insertion S.pdf
 
Matlab cheatsheet
Matlab cheatsheetMatlab cheatsheet
Matlab cheatsheet
 
Python Lecture 11
Python Lecture 11Python Lecture 11
Python Lecture 11
 
3 kotlin vs. java- what kotlin has that java does not
3  kotlin vs. java- what kotlin has that java does not3  kotlin vs. java- what kotlin has that java does not
3 kotlin vs. java- what kotlin has that java does not
 
Fp in scala part 2
Fp in scala part 2Fp in scala part 2
Fp in scala part 2
 
The Ring programming language version 1.9 book - Part 31 of 210
The Ring programming language version 1.9 book - Part 31 of 210The Ring programming language version 1.9 book - Part 31 of 210
The Ring programming language version 1.9 book - Part 31 of 210
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdf
 
ifelse.pptx
ifelse.pptxifelse.pptx
ifelse.pptx
 
Python 04-ifelse-return-input-strings.pptx
Python 04-ifelse-return-input-strings.pptxPython 04-ifelse-return-input-strings.pptx
Python 04-ifelse-return-input-strings.pptx
 
fds Practicle 1to 6 program.pdf
fds Practicle 1to 6 program.pdffds Practicle 1to 6 program.pdf
fds Practicle 1to 6 program.pdf
 
世预赛买球-世预赛买球竞彩平台-世预赛买球竞猜平台|【​网址​🎉ac123.net🎉​】
世预赛买球-世预赛买球竞彩平台-世预赛买球竞猜平台|【​网址​🎉ac123.net🎉​】世预赛买球-世预赛买球竞彩平台-世预赛买球竞猜平台|【​网址​🎉ac123.net🎉​】
世预赛买球-世预赛买球竞彩平台-世预赛买球竞猜平台|【​网址​🎉ac123.net🎉​】
 
美洲杯买球-美洲杯买球怎么押注-美洲杯买球押注怎么玩|【​网址​🎉ac99.net🎉​】
美洲杯买球-美洲杯买球怎么押注-美洲杯买球押注怎么玩|【​网址​🎉ac99.net🎉​】美洲杯买球-美洲杯买球怎么押注-美洲杯买球押注怎么玩|【​网址​🎉ac99.net🎉​】
美洲杯买球-美洲杯买球怎么押注-美洲杯买球押注怎么玩|【​网址​🎉ac99.net🎉​】
 
欧洲杯足彩-欧洲杯足彩线上体育买球-欧洲杯足彩买球推荐网站|【​网址​🎉ac55.net🎉​】
欧洲杯足彩-欧洲杯足彩线上体育买球-欧洲杯足彩买球推荐网站|【​网址​🎉ac55.net🎉​】欧洲杯足彩-欧洲杯足彩线上体育买球-欧洲杯足彩买球推荐网站|【​网址​🎉ac55.net🎉​】
欧洲杯足彩-欧洲杯足彩线上体育买球-欧洲杯足彩买球推荐网站|【​网址​🎉ac55.net🎉​】
 

More from vikram mahendra

Communication skill
Communication skillCommunication skill
Communication skill
vikram mahendra
 
Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
vikram mahendra
 
Python Project on Computer Shop
Python Project on Computer ShopPython Project on Computer Shop
Python Project on Computer Shop
vikram mahendra
 
PYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEMPYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEM
vikram mahendra
 
BOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in PythonBOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in Python
vikram mahendra
 
FLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHONFLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHON
vikram mahendra
 
FLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHONFLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHON
vikram mahendra
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
vikram mahendra
 
OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1
vikram mahendra
 
OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2
vikram mahendra
 
USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2
vikram mahendra
 
DATA TYPE IN PYTHON
DATA TYPE IN PYTHONDATA TYPE IN PYTHON
DATA TYPE IN PYTHON
vikram mahendra
 
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
vikram mahendra
 
USER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHONUSER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHON
vikram mahendra
 
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
vikram mahendra
 
INTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHONINTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHON
vikram mahendra
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
vikram mahendra
 
GREEN SKILL[PART-2]
GREEN SKILL[PART-2]GREEN SKILL[PART-2]
GREEN SKILL[PART-2]
vikram mahendra
 
GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]
vikram mahendra
 
Dictionary in python
Dictionary in pythonDictionary in python
Dictionary in python
vikram mahendra
 

More from vikram mahendra (20)

Communication skill
Communication skillCommunication skill
Communication skill
 
Python Project On Cosmetic Shop system
Python Project On Cosmetic Shop systemPython Project On Cosmetic Shop system
Python Project On Cosmetic Shop system
 
Python Project on Computer Shop
Python Project on Computer ShopPython Project on Computer Shop
Python Project on Computer Shop
 
PYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEMPYTHON PROJECT ON CARSHOP SYSTEM
PYTHON PROJECT ON CARSHOP SYSTEM
 
BOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in PythonBOOK SHOP SYSTEM Project in Python
BOOK SHOP SYSTEM Project in Python
 
FLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHONFLOW OF CONTROL-NESTED IFS IN PYTHON
FLOW OF CONTROL-NESTED IFS IN PYTHON
 
FLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHONFLOWOFCONTROL-IF..ELSE PYTHON
FLOWOFCONTROL-IF..ELSE PYTHON
 
FLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHONFLOW OF CONTROL-INTRO PYTHON
FLOW OF CONTROL-INTRO PYTHON
 
OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1OPERATOR IN PYTHON-PART1
OPERATOR IN PYTHON-PART1
 
OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2OPERATOR IN PYTHON-PART2
OPERATOR IN PYTHON-PART2
 
USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2USE OF PRINT IN PYTHON PART 2
USE OF PRINT IN PYTHON PART 2
 
DATA TYPE IN PYTHON
DATA TYPE IN PYTHONDATA TYPE IN PYTHON
DATA TYPE IN PYTHON
 
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
USER DEFINE FUNCTIONS IN PYTHON[WITH PARAMETERS]
 
USER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHONUSER DEFINE FUNCTIONS IN PYTHON
USER DEFINE FUNCTIONS IN PYTHON
 
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]FUNCTIONS IN PYTHON[RANDOM FUNCTION]
FUNCTIONS IN PYTHON[RANDOM FUNCTION]
 
INTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHONINTRODUCTION TO FUNCTIONS IN PYTHON
INTRODUCTION TO FUNCTIONS IN PYTHON
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
GREEN SKILL[PART-2]
GREEN SKILL[PART-2]GREEN SKILL[PART-2]
GREEN SKILL[PART-2]
 
GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]GREEN SKILLS[PART-1]
GREEN SKILLS[PART-1]
 
Dictionary in python
Dictionary in pythonDictionary in python
Dictionary in python
 

Recently uploaded

Beginner's Guide to Observability@Devoxx PL 2024
Beginner's  Guide to Observability@Devoxx PL 2024Beginner's  Guide to Observability@Devoxx PL 2024
Beginner's Guide to Observability@Devoxx PL 2024
michniczscribd
 
🔥 Kolkata Call Girls  👉 9079923931 👫 High Profile Call Girls Whatsapp Number ...
🔥 Kolkata Call Girls  👉 9079923931 👫 High Profile Call Girls Whatsapp Number ...🔥 Kolkata Call Girls  👉 9079923931 👫 High Profile Call Girls Whatsapp Number ...
🔥 Kolkata Call Girls  👉 9079923931 👫 High Profile Call Girls Whatsapp Number ...
tinakumariji156
 
Hands-on with Apache Druid: Installation & Data Ingestion Steps
Hands-on with Apache Druid: Installation & Data Ingestion StepsHands-on with Apache Druid: Installation & Data Ingestion Steps
Hands-on with Apache Druid: Installation & Data Ingestion Steps
servicesNitor
 
AI Based Testing - A Comprehensive Guide.pdf
AI Based Testing - A Comprehensive Guide.pdfAI Based Testing - A Comprehensive Guide.pdf
AI Based Testing - A Comprehensive Guide.pdf
kalichargn70th171
 
Solar Panel Service Provider annual maintenance contract.pdf
Solar Panel Service Provider annual maintenance contract.pdfSolar Panel Service Provider annual maintenance contract.pdf
Solar Panel Service Provider annual maintenance contract.pdf
SERVE WELL CRM NASHIK
 
🔥 Chennai Call Girls  👉 6350257716 👫 High Profile Call Girls Whatsapp Number ...
🔥 Chennai Call Girls  👉 6350257716 👫 High Profile Call Girls Whatsapp Number ...🔥 Chennai Call Girls  👉 6350257716 👫 High Profile Call Girls Whatsapp Number ...
🔥 Chennai Call Girls  👉 6350257716 👫 High Profile Call Girls Whatsapp Number ...
tinakumariji156
 
Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...
Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...
Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...
Anita pandey
 
European Standard S1000D, an Unnecessary Expense to OEM.pptx
European Standard S1000D, an Unnecessary Expense to OEM.pptxEuropean Standard S1000D, an Unnecessary Expense to OEM.pptx
European Standard S1000D, an Unnecessary Expense to OEM.pptx
Digital Teacher
 
Photo Copier Xerox Machine annual maintenance contract system.pdf
Photo Copier Xerox Machine annual maintenance contract system.pdfPhoto Copier Xerox Machine annual maintenance contract system.pdf
Photo Copier Xerox Machine annual maintenance contract system.pdf
SERVE WELL CRM NASHIK
 
Accelerate your Sitecore development with GenAI
Accelerate your Sitecore development with GenAIAccelerate your Sitecore development with GenAI
Accelerate your Sitecore development with GenAI
Ahmed Okour
 
Happy Birthday Kubernetes, 10th Birthday edition of Kubernetes Birthday in Au...
Happy Birthday Kubernetes, 10th Birthday edition of Kubernetes Birthday in Au...Happy Birthday Kubernetes, 10th Birthday edition of Kubernetes Birthday in Au...
Happy Birthday Kubernetes, 10th Birthday edition of Kubernetes Birthday in Au...
Chad Crowell
 
The Ultimate Guide to Top 36 DevOps Testing Tools for 2024.pdf
The Ultimate Guide to Top 36 DevOps Testing Tools for 2024.pdfThe Ultimate Guide to Top 36 DevOps Testing Tools for 2024.pdf
The Ultimate Guide to Top 36 DevOps Testing Tools for 2024.pdf
kalichargn70th171
 
Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7
Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7
Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7
manji sharman06
 
Female Bangalore Call Girls 👉 7023059433 👈 Vip Escorts Service Available
Female Bangalore Call Girls 👉 7023059433 👈 Vip Escorts Service AvailableFemale Bangalore Call Girls 👉 7023059433 👈 Vip Escorts Service Available
Female Bangalore Call Girls 👉 7023059433 👈 Vip Escorts Service Available
isha sharman06
 
SAP ECC & S4 HANA PPT COMPARISON MM.pptx
SAP ECC & S4 HANA PPT COMPARISON MM.pptxSAP ECC & S4 HANA PPT COMPARISON MM.pptx
SAP ECC & S4 HANA PPT COMPARISON MM.pptx
aneeshmanikantan2341
 
Enhancing non-Perl bioinformatic applications with Perl
Enhancing non-Perl bioinformatic applications with PerlEnhancing non-Perl bioinformatic applications with Perl
Enhancing non-Perl bioinformatic applications with Perl
Christos Argyropoulos
 
Hot Call Girls In Ahmedabad ✔ 7737669865 ✔ Hi I Am Divya Vip Call Girl Servic...
Hot Call Girls In Ahmedabad ✔ 7737669865 ✔ Hi I Am Divya Vip Call Girl Servic...Hot Call Girls In Ahmedabad ✔ 7737669865 ✔ Hi I Am Divya Vip Call Girl Servic...
Hot Call Girls In Ahmedabad ✔ 7737669865 ✔ Hi I Am Divya Vip Call Girl Servic...
ns9201415
 
What’s New in VictoriaLogs - Q2 2024 Update
What’s New in VictoriaLogs - Q2 2024 UpdateWhat’s New in VictoriaLogs - Q2 2024 Update
What’s New in VictoriaLogs - Q2 2024 Update
VictoriaMetrics
 
Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...
Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...
Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...
simmi singh$A17
 
Building API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructureBuilding API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructure
confluent
 

Recently uploaded (20)

Beginner's Guide to Observability@Devoxx PL 2024
Beginner's  Guide to Observability@Devoxx PL 2024Beginner's  Guide to Observability@Devoxx PL 2024
Beginner's Guide to Observability@Devoxx PL 2024
 
🔥 Kolkata Call Girls  👉 9079923931 👫 High Profile Call Girls Whatsapp Number ...
🔥 Kolkata Call Girls  👉 9079923931 👫 High Profile Call Girls Whatsapp Number ...🔥 Kolkata Call Girls  👉 9079923931 👫 High Profile Call Girls Whatsapp Number ...
🔥 Kolkata Call Girls  👉 9079923931 👫 High Profile Call Girls Whatsapp Number ...
 
Hands-on with Apache Druid: Installation & Data Ingestion Steps
Hands-on with Apache Druid: Installation & Data Ingestion StepsHands-on with Apache Druid: Installation & Data Ingestion Steps
Hands-on with Apache Druid: Installation & Data Ingestion Steps
 
AI Based Testing - A Comprehensive Guide.pdf
AI Based Testing - A Comprehensive Guide.pdfAI Based Testing - A Comprehensive Guide.pdf
AI Based Testing - A Comprehensive Guide.pdf
 
Solar Panel Service Provider annual maintenance contract.pdf
Solar Panel Service Provider annual maintenance contract.pdfSolar Panel Service Provider annual maintenance contract.pdf
Solar Panel Service Provider annual maintenance contract.pdf
 
🔥 Chennai Call Girls  👉 6350257716 👫 High Profile Call Girls Whatsapp Number ...
🔥 Chennai Call Girls  👉 6350257716 👫 High Profile Call Girls Whatsapp Number ...🔥 Chennai Call Girls  👉 6350257716 👫 High Profile Call Girls Whatsapp Number ...
🔥 Chennai Call Girls  👉 6350257716 👫 High Profile Call Girls Whatsapp Number ...
 
Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...
Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...
Premium Call Girls In Ahmedabad 💯Call Us 🔝 7426014248 🔝Independent Ahmedabad ...
 
European Standard S1000D, an Unnecessary Expense to OEM.pptx
European Standard S1000D, an Unnecessary Expense to OEM.pptxEuropean Standard S1000D, an Unnecessary Expense to OEM.pptx
European Standard S1000D, an Unnecessary Expense to OEM.pptx
 
Photo Copier Xerox Machine annual maintenance contract system.pdf
Photo Copier Xerox Machine annual maintenance contract system.pdfPhoto Copier Xerox Machine annual maintenance contract system.pdf
Photo Copier Xerox Machine annual maintenance contract system.pdf
 
Accelerate your Sitecore development with GenAI
Accelerate your Sitecore development with GenAIAccelerate your Sitecore development with GenAI
Accelerate your Sitecore development with GenAI
 
Happy Birthday Kubernetes, 10th Birthday edition of Kubernetes Birthday in Au...
Happy Birthday Kubernetes, 10th Birthday edition of Kubernetes Birthday in Au...Happy Birthday Kubernetes, 10th Birthday edition of Kubernetes Birthday in Au...
Happy Birthday Kubernetes, 10th Birthday edition of Kubernetes Birthday in Au...
 
The Ultimate Guide to Top 36 DevOps Testing Tools for 2024.pdf
The Ultimate Guide to Top 36 DevOps Testing Tools for 2024.pdfThe Ultimate Guide to Top 36 DevOps Testing Tools for 2024.pdf
The Ultimate Guide to Top 36 DevOps Testing Tools for 2024.pdf
 
Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7
Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7
Call Girls Bangalore🔥7023059433🔥Best Profile Escorts in Bangalore Available 24/7
 
Female Bangalore Call Girls 👉 7023059433 👈 Vip Escorts Service Available
Female Bangalore Call Girls 👉 7023059433 👈 Vip Escorts Service AvailableFemale Bangalore Call Girls 👉 7023059433 👈 Vip Escorts Service Available
Female Bangalore Call Girls 👉 7023059433 👈 Vip Escorts Service Available
 
SAP ECC & S4 HANA PPT COMPARISON MM.pptx
SAP ECC & S4 HANA PPT COMPARISON MM.pptxSAP ECC & S4 HANA PPT COMPARISON MM.pptx
SAP ECC & S4 HANA PPT COMPARISON MM.pptx
 
Enhancing non-Perl bioinformatic applications with Perl
Enhancing non-Perl bioinformatic applications with PerlEnhancing non-Perl bioinformatic applications with Perl
Enhancing non-Perl bioinformatic applications with Perl
 
Hot Call Girls In Ahmedabad ✔ 7737669865 ✔ Hi I Am Divya Vip Call Girl Servic...
Hot Call Girls In Ahmedabad ✔ 7737669865 ✔ Hi I Am Divya Vip Call Girl Servic...Hot Call Girls In Ahmedabad ✔ 7737669865 ✔ Hi I Am Divya Vip Call Girl Servic...
Hot Call Girls In Ahmedabad ✔ 7737669865 ✔ Hi I Am Divya Vip Call Girl Servic...
 
What’s New in VictoriaLogs - Q2 2024 Update
What’s New in VictoriaLogs - Q2 2024 UpdateWhat’s New in VictoriaLogs - Q2 2024 Update
What’s New in VictoriaLogs - Q2 2024 Update
 
Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...
Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...
Independent Call Girls In Kolkata ✔ 7014168258 ✔ Hi I Am Divya Vip Call Girl ...
 
Building API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructureBuilding API data products on top of your real-time data infrastructure
Building API data products on top of your real-time data infrastructure
 

Programming in lua STRING AND ARRAY

  • 2. INDEX Program to accept the string and count number of vowels in it. Program to accept the string and count number words whose first letter is vowel. Program to accept the string and check it’s a palindrome or not Program to accept the number from user and search it in an array of 10 numbers using linear search. Program to accept the numbers in an array unsorted order and display it in selection sort. Program to swap first element with last, second to second last and so on (reversing elements) Program to create a function name swap2best() with array as a parameter and swap all the even index value. Program to print the left diagonal from a 2D array Program to swap the first row of the array with the last row of the array Program to print the lower half of the 2d array.
  • 3. Program to accept the string and count number of vowels in it. function vowelcount(sent) k=string.len(sent) x=1 count=0 while(x<=k) do ch=string.sub(sent,x,x) if(ch=='a' or ch=='e' or ch=='i' or ch=='u' or ch=='o') then count=count+1 end x=x+1 end print("no of vowels are = "..count) end vowelcount("my first program of vowel") ------------------output--------------------------- no of vowels are = 6
  • 4. Program to accept the string and count number words whose first letter is vowel. function vowelcount(sent) k=string.len(sent) x=1 count=0 flag=1 while(x<=k) do ch=string.sub(sent,x,x) if(flag==1) then ch=string.sub(sent,x,x) if(ch=='a' or ch=='e' or ch=='i' or ch=='u' or ch=='o') then count=count+1 flag=0 end end if(ch==' ') then x=x+1 ch=string.sub(sent,x,x) if(ch=='a' or ch=='e' or ch=='i' or ch=='u' or ch=='o') then count=count+1 end end x=x+1 end print("no of vowels are = "..count) end vowelcount("its my irst program of vowel word in our") -------------------output------------------- no of vowels are = 5
  • 5. Program to accept the string and check it’s a palindrome or not function checkpal(nm) k=string.len(nm) for x=1,math.floor(string.len(nm)/2),1 do if(string.sub(nm,x,x) == string.sub(nm,k,k)) then flag=1 else flag=-1 break end k=k-1 end return flag end nm=io.read() t=checkpal(nm) if(t==1) then print("Its a pal") else print("Its not a pal") end --------------output---------------- madam Its a pal
  • 6. Program to accept the number from user and search it in an array of 10 numbers using linear search. no={5,10,25,8,6,53,4,9,12,14} x=1 pos=-1 print("enter the number to search") search=tonumber(io.read()) while(x<=10) do if(no[x]==search) then pos=x break end x=x+1 end if(pos<0) then print("no not found") else print("no found at "..pos) end ----------------------output---------------------- enter the number to search 6 no found at 5
  • 7. Program to accept the numbers in an array unsorted order and display it in selection sort. no={5,10,25,8,6,53,4,9,12,14} x=1 tmp=0 print("before sorting") while(x<=10) do io.write(no[x].." ") x=x+1 end print() x=1 while(x<=10) do y=x+1 while(y<=10) do if(no[x]>no[y]) then tmp=no[x] no[x]=no[y] no[y]=tmp end y=y+1 end x=x+1 end print("After sorting") x=1 while(x<=10) do io.write(no[x].." ") x=x+1 end ------------------output---------------------- before sorting 5 10 25 8 6 53 4 9 12 14 After sorting 4 5 6 8 9 10 12 14 25 53
  • 8. program to swap first element with last, second to second last and so on (reversing elements) no={5,10,25,8,6,53,4,9,12,14} x=1 tmp=0 print("Before........") while(x<=10) do io.write(no[x].." ") x=x+1 end x=1 print() y=10 for x=1,math.floor(10/2) do tmp=no[x] no[x]=no[y] no[y]=tmp y=y-1 end print("nAfter........") x=1 while(x<=10) do io.write(no[x].." ") x=x+1 end ------------------output------------------------- Before........ 5 10 25 8 6 53 4 9 12 14 After........ 14 12 9 4 53 6 8 25 10 5
  • 9. Program to create a function name swap2best() with array as a parameter and swap all the even index value. function swap2best(no) x=1 tmp=0 print("Before........") while(x<=10) do io.write(no[x].." ") x=x+1 end x=1 print() for x=1,10,2 do tmp=no[x] no[x]=no[x+1] no[x+1]=tmp end print("nAfter........") x=1 while(x<=10) do io.write(no[x].." ") x=x+1 end end no={10,20,30,40,50,60,70,80,90,110} swap2best(no) -------------------output-------------------- Before........ 10 20 30 40 50 60 70 80 90 110 After........ 20 10 40 30 60 50 80 70 110 90
  • 10. Program to print the left diagonal from a 2D array function display(no,N) x=1 tmp=0 print("Before........") while(x<=N) do y=1 while(y<=N) do io.write(no[x][y].."t") y=y+1 end print() x=x+1 end end function displayleftdiagonal(no,N) for x=1,N do print(no[x][x]) end end no={{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}} display(no,4) displayleftdiagonal(no,4) ------------------output------------------ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 6 11 16
  • 11. Program to swap the first row of the array with the last row of the array function display(no,R,C) x=1 tmp=0 print(".....................") while(x<=R) do y=1 while(y<=C) do io.write(no[x][y].."t") y=y+1 end print() x=x+1 end end function swapfirstwithlastR(no,R,C) last=R for x=1,C do tmp=no[1][x] no[1][x]=no[last][x] no[last][x]=tmp end end no={{1,2,3,4,1,5,7},{5,6,7,8,8,9,4},{9,10,11,12,11,23,5},{13,14,15,16,1,2,8}} display(no,4,7) swapfirstwithlastR(no,4,7) display(no,4,7) ------------------output-------------------- ..................... 1 2 3 4 1 5 7 5 6 7 8 8 9 4 9 10 11 12 11 23 5 13 14 15 16 1 2 8 ..................... 13 14 15 16 1 2 8 5 6 7 8 8 9 4 9 10 11 12 11 23 5 1 2 3 4 1 5 7
  • 12. Program to print the lower half of the 2d array. function display(no,R,C) x=1 tmp=0 print(".....................") while(x<=R) do y=1 while(y<=C) do io.write(no[x][y].."t") y=y+1 end print() x=x+1 end end function lowerhalf(no,R,C) for x=1,R do for y=1,C do if(x>=y) then io.write(no[x][y].." ") end end print() end end no={{1,2,3,4,1,5,7},{5,6,7,8,8,9,4},{9,10,11,12,11,23,5},{13,14,15,16,1,2,8}} display(no,4,7) lowerhalf(no,4,7) -----------------output------------------------- 1 2 3 4 1 5 7 5 6 7 8 8 9 4 9 10 11 12 11 23 5 13 14 15 16 1 2 8 1 5 6 9 10 11 13 14 15 16
  翻译: