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


Please Help Members By Posting Answers For Below Questions

What is structure padding in c?

629


What are run-time errors?

600


Explain setjmp()?

660


What are the advantages of using macro in c language?

595


Is javascript based on c?

595






Explain what standard functions are available to manipulate strings?

613


Why main is not a keyword in c?

652


What is scope and lifetime of a variable in c?

579


plz let me know how to become a telecom protocol tester. thank you.

1743


Differentiate between ordinary variable and pointer in c.

620


Do pointers take up memory?

660


Who is the founder of c language?

687


What does emoji p mean?

606


Explain what is the best way to comment out a section of code that contains comments?

723


What is a method in c?

629