A big question in C loop! | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

A big question in C loop!

This is a simple program to output substrings #include<string.h> #include<stdio.h> int main ( ) { int i , j , k , inp ; char str[10]; scanf ( " %s " , str ) ; inp=strlen(str); for(i=0;i<=inp-1;i++) { for(j=i;j>=0;j--) { for ( k = j ; k <=i ; k + + ) { printf ( " %c " , str [ k ] ) ; putchar ( ' /n' ) ; } } } the out put should be like below if i input "abcd" a b c d ab bc cd abc bcd abcd but my program 's output format is always incorrect a b ab c bc abc d cd bcd abcd Always get the wrong order

4th Mar 2019, 4:00 PM
LapterGrsd
LapterGrsd - avatar
6 ответов
+ 2
I have used a different logic, but it's printing the given pattern: https://code.sololearn.com/ck7GC2uZ5GjW/?ref=app
5th Mar 2019, 4:10 PM
Sinjini Das
Sinjini Das - avatar
+ 2
LapterGrsd would you mind posting the link of this code i code playground. It will be easy to us to find a solution
4th Mar 2019, 4:19 PM
Seniru
Seniru - avatar
+ 2
Sinjini Das Wow!Dude you are anwsome ! Thanks alot!!!!◠‿◠
5th Mar 2019, 4:40 PM
LapterGrsd
LapterGrsd - avatar
+ 2
😁....LapterGrsd
5th Mar 2019, 4:45 PM
Sinjini Das
Sinjini Das - avatar
4th Mar 2019, 10:38 PM
LapterGrsd
LapterGrsd - avatar
0
so how to fix the output format ?,,thanks
4th Mar 2019, 4:01 PM
LapterGrsd
LapterGrsd - avatar