+ 1

How I can write a program in CS with this output (COMPUTER IS A WORLD OF SCIENCE)?

C O M P U T E R I S A W O R L D O F S C I E N C E

30th Sep 2020, 5:36 PM
Emran Afghan
Emran Afghan - avatar
2 Respostas
+ 1
The following works: using System; namespace SoloLearn { class Program { static void Main(string[] args) { string msg = "computer is a world of science"; msg = msg.Replace(" ", "").ToUpper(); int index = 0; int maxLen = 5; int len; for (len = 1; len <= maxLen; len++) { Console.WriteLine(msg.Substring(index, len)); index += len; } for (len-=2; len >= 1 && index < msg.Length; len--) { Console.WriteLine(msg.Substring(index, len)); index += len; } } } }
1st Oct 2020, 5:45 AM
Josh Greig
Josh Greig - avatar
0
So nice 😍 Thanks a lot Mr. Josh Greig
1st Oct 2020, 12:22 PM
Emran Afghan
Emran Afghan - avatar