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
can anyone suggest some site name..where i can get some good data structure puzzles???
How will you divide two numbers in a MACRO?
Why can arithmetic operations not be performed on void pointers?
what is a constant pointer in C
Explain how do you search data in a data file using random access method?
In a byte, what is the maximum decimal number that you can accommodate?
What are the advantage of c language?
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.
What are external variables in c?
What are pointers?
List the difference between a "copy constructor" and a "assignment operator"?
Why does everyone say not to use scanf? What should I use instead?
How is a null pointer different from a dangling pointer?
What is #line?
What is operator promotion?