3. Program to print all possible substrings.
ex: String
S
St
Str
Stri
Strin
String
t
tr
tri
trin
tring
r
Answer Posted / rafiq
#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
int i,j,n,k;
char a[10]="String";
i=0;
n=strlen(a);
for(i=0;i<n;i++)
{
for(j=i;j<n;j++)
{
for(k=i;k<j+1;k++)
{
printf("%c",a[k]);
}
printf("\n");
}
}
getch();
}
Is This Answer Correct ? | 51 Yes | 23 No |
Post New Answer View All Answers
What is structure padding in c?
What are run-time errors?
Explain setjmp()?
What are the advantages of using macro in c language?
Is javascript based on c?
Explain what standard functions are available to manipulate strings?
Why main is not a keyword in c?
What is scope and lifetime of a variable in c?
plz let me know how to become a telecom protocol tester. thank you.
Differentiate between ordinary variable and pointer in c.
Do pointers take up memory?
Who is the founder of c language?
What does emoji p mean?
Explain what is the best way to comment out a section of code that contains comments?
What is a method in c?