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
Why & is used in scanf in c?
Tell me what are bitwise shift operators?
How can I convert a number to a string?
How can I open files mentioned on the command line, and parse option flags?
What are header files and what are its uses in C programming?
How reliable are floating-point comparisons?
What is the maximum no. of arguments that can be given in a command line in C.?
What is an example of structure?
Write a program to print fibonacci series using recursion?
Where are some collections of useful code fragments and examples?
Is it fine to write void main () or main () in c?
In which layer of the network datastructure format change is done
Why static is used in c?
Give the rules for variable declaration?
Are the variables argc and argv are local to main?