String Problem #1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
1234
-->1 2 3 4 | 12 23 34 | 123 234 | 1234
*/
int main()
{
char input[6];
printf("enter string = ");
scanf("%s", &input);
for (int k = 0; k < strlen(input); k++) //for limit of k, check limit of x below. ( we also want the exact string )
{
for (int i = 0; i < strlen(input) - k; i++)
{
for (int x = 0; x <= k; x++)
{
printf("%c", input[i + x]);
}
printf(" ");
}
}
return 0;

Comments
Post a Comment