نام کتاب: Linux Socket Programming
نویسنده: Brain Hall
مترجم: غلامرضا صابری تبریزی
زبان : فارسی
نوع فایل: PDF
تعداد صفحات: 47 صفحه
حجم:381(کیلوبایت)
دانلود از سرور سایت
نام کتاب: Linux Socket Programming
نویسنده: Brain Hall
مترجم: غلامرضا صابری تبریزی
زبان : فارسی
نوع فایل: PDF
تعداد صفحات: 47 صفحه
حجم:381(کیلوبایت)
دانلود از سرور سایت
این برنامه عمل شمارش حروف را در یک رشته را نشان می دهد
کد:Program :- To count the number of character in a given string. echo Enter a string read str nc=`expr $str | wc -c` n=`expr $nc - 1` echo Number of character in $str is : $n
خروجی برنامه
کد:Enter a string network Number of character in network is : 7
uody
برنامه ای برای شمارش حروف صدا دار
کد:Program :- To count number of vowels. echo Enter a string read str nc=`expr $str | wc -c` i=1 n=0 while [ $i -le $nc ] do ch=`echo $str | cut -c $i` case $ch in [aeiouAEIOU]) n=`expr $n + 1`;; esac i=`expr $i + 1` done echo Number of vowels is : $n
خروجی برنامه
کد:Enter a string gopinath Number of vowels is : 3
uody
چاپ تمامی اعداد اول بین دو بازه عددی
.
کد:echo Enter the limits read ll ul echo prime numbers in between $ll and $ul while [ $ll -lt $ul ] do n=`expr $ll - 1` m=2 flag=1 while [ $m -le $n ] do k=`expr $ll % $m` if [ $k -eq 0 ] then flag=0 break fi m=`expr $m + 1` done if [ $flag -eq 1 ] then echo $ll fi ll=`expr $ll + 1` done
خروجی:
کد:Enter the limits 5 21 Prime numbers in between 5 and 21 5 7 11 13 17 19
uody
آیا سال معین شده سال کبیسه است یا خیر
کد:echo Enter the year read yy a=`expr $yy % 4` b=`expr $yy % 100` c=`expr $yy % 400` if [ $a -eq 0 -a $b -ne 0 -o $c -eq 0 ] then echo $yy is leap year else echo $yy is not a leap year fi
خروجی 1:
کد:Enter the year 2004 2004 is leap year
خروجی 2:
کد:Enter the year 2006 2006 is not a leap year
uody
برنامه ای به منظور چک کردن اینکه آیا رشته کلمه داده شده از دو سو یکی است یا خیر
خروجی 1:کد:echo Enter a string read str1 str2=$str1 nc=`expr $str1 | wc -c` i=`expr $nc - 1` j=1 while [ $i -gt 0 ] do ch1=`echo $str1 | cut -c $j` ch2=`echo $str2 | cut -c $i` if [ $ch1 != $ch2 ] then echo $str1 is not palindrome exit fi j=`expr $j + 1` i=`expr $i - 1` done echo $str1 is palindrome
خروجی2:کد:Enter a string malayalam malayalam is palindrome
کد:Enter a string subnetwork subnetwork is not palindrome
uody
برنامه برای بررسی اینکه عدد موردنظر زوج و یا فرد است
خروجی1:کد:echo Enter a number read n m=`expr $n % 2` if [ $m -eq 0 ] then echo Given number is even else echo Given number is odd fi
خروجی2:کد:Enter a number 123 Given number is odd
منبع:www.subnet.irکد:Enter a number 122 Given number is even
uody
در حال حاضر 1 کاربر در حال مشاهده این موضوع است. (0 کاربران و 1 مهمان ها)
علاقه مندی ها (Bookmarks)