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
6 odpowiedzi
+ 2
I have used a different logic, but it's printing the given pattern:
https://code.sololearn.com/ck7GC2uZ5GjW/?ref=app
+ 2
LapterGrsd would you mind posting the link of this code i code playground. It will be easy to us to find a solution
+ 2
Sinjini Das Wow!Dude you are anwsome ! Thanks alot!!!!◠‿◠
+ 2
😁....LapterGrsd
+ 1
0
so how to fix the output format ?,,thanks