Created
September 9, 2013 23:28
-
-
Save ravidaram/6502911 to your computer and use it in GitHub Desktop.
Home Work Due 09/08/2013
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DIG | |
| MAX | |
| round | |
| zero | |
| nan? | |
| angle | |
| RADIX | |
| EPSILON | |
| coerce | |
| divmod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| chr | |
| downto | |
| upto | |
| even | |
| odd | |
| ceil | |
| floor | |
| times | |
| to_i | |
| to_r | |
| truncate | |
| next | |
| pred | |
| gcd | |
| gcdlcm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| puts"enter 5 strings" | |
| str1=gets.chomp | |
| str2=gets.chomp | |
| str3=gets.chomp | |
| str4=gets.chomp | |
| str5=gets.chomp | |
| flg=" " | |
| if ((str1.length > str2.length) && ((str1.length > str3.length) && | |
| (str1.length > str4.length) && | |
| (str1.length > str5.length))) | |
| puts "Longest String is #{str1}" | |
| flg="y" | |
| elsif ((str2.length > str3.length) && (str2.length > str4.length) && | |
| (str2.length > str5.length)) | |
| puts "Longest String is #{str2}" | |
| flg="y" | |
| elsif ((str3.length > str4.length) && (str3.length > str5.length) ) | |
| puts "Longest String is #{str3}" | |
| flg="y" | |
| elsif (str4.length > str5.length) | |
| puts "Longest String is #{str4}" | |
| flg="y" | |
| else | |
| puts "Longest string is #{str5}" | |
| flg = "y" | |
| end | |
| if flg == " " | |
| puts "All strings are same in length" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| puts "Enter a string" | |
| str = gets.chomp | |
| if (str == str.reverse) | |
| puts "Entered string is a palindrome" | |
| else | |
| puts "Entered string is not a palindrome" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment