3. Program to print all possible substrings.

ex: String
S
St
Str
Stri
Strin
String
t
tr
tri
trin
tring
r

Answer Posted / nik

#include<stdio.h>
#include<conio.h>
#include<string.h>
int main(){
int i,j=0,k=0,n;
char str[50],str1[25],str2[25],temp;
puts("Enter String");
gets(str);
n=strlen(str);
for(i=0;i<n;i++){
for(j=i;j<n;j++){
for(k=j;k<n;k++){

printf("%c",str[k]);
}

printf("\n");
}

printf("\n");
}
getch();
}

Is This Answer Correct ?    15 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why & is used in scanf in c?

612


Tell me what are bitwise shift operators?

648


How can I convert a number to a string?

601


How can I open files mentioned on the command line, and parse option flags?

583


What are header files and what are its uses in C programming?

623






How reliable are floating-point comparisons?

621


What is the maximum no. of arguments that can be given in a command line in C.?

658


What is an example of structure?

581


Write a program to print fibonacci series using recursion?

580


Where are some collections of useful code fragments and examples?

704


Is it fine to write void main () or main () in c?

537


In which layer of the network datastructure format change is done

1424


Why static is used in c?

614


Give the rules for variable declaration?

665


Are the variables argc and argv are local to main?

778