Created
February 26, 2016 14:01
-
-
Save ravichandrae/8e7c0d4fc6abc9aab6a2 to your computer and use it in GitHub Desktop.
Printing the given string as a cross mark
This file contains 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
#include <iostream> | |
using namespace std; | |
int main() { | |
string input="12345"; | |
int len = input.size(); | |
int i,j; | |
for( i = 0; i < len; i++) | |
{ | |
for( j = 0; j < len; j++) | |
{ | |
if( i == j || j == len-i-1) | |
cout << input[i]; | |
else | |
cout << " "; | |
} | |
cout << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment