Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 are the different types of control structures?

1043


Can one function call another?

1112


Are the expressions * ptr ++ and ++ * ptr same?

1149


What are the string functions? List some string functions available in c.

991


What is #include stdlib h?

1103


Why c is a procedural language?

1054


Can static variables be declared in a header file?

1060


What should malloc(0) do?

1119


What is the role of this pointer?

1070


Where define directive used?

1089


Linked list is a Linear or non linear explain if linear how it working as a non linear data structures

2179


When can you use a pointer with a function?

1066


can we have joblib in a proc ?

2302


Define Spanning-Tree Protocol (STP)

1129


What is the difference between #include and #include 'file' ?

1053