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

Explain can static variables be declared in a header file?

664


What is header file in c?

594


Describe the modifier in c?

590


Tell me what are bitwise shift operators?

646


 write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare.  You will then tabulate this information in another file.

1719






write a C program: To recognize date of any format even formats like "feb-02-2003","02-february-2003",mm/dd/yy, dd/mm/yy and display it as mm/dd/yy.

3329


What is the g value paradox?

630


What is C language ?

1517


write a c program to print the next of a particular no without using the arithmetic operator or looping statements?

3168


What are all different types of pointers in c?

566


Can you define which header file to include at compile time?

573


Explain argument and its types.

589


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

658


program for reversing a selected line word by word when multiple lines are given without using strrev

1934


write a program to convert a expression in polish notation(postfix) to inline(normal) something like make 723+* (2+3) x 7 (not sure) just check out its mainly printing expression in postfix form to infix.

3493