Showing posts with label string. Show all posts
Showing posts with label string. Show all posts

Tuesday, 1 May 2012

Program To Print Substring In C

#include<stdio.h>
#include<conio.h>
void substr(char x[20]);
main()
{
char a[20];
int l;
clrscr();
puts("ENter String=");
substr(a);
getch();
}

{
   int i,beg,n;
   printf("ENter Beg=");
   scanf("%d",&beg);
   printf("ENter How many Leteers=");
   scanf("%d",&n);
   for(i=beg;i<=n;i++)
   {
   printf("%c",x[i]);
   }
}

Friday, 27 April 2012

Find Length Of String Program IN C


#include<stdio.h>
#include<conio.h>
#include<string.h>
main()
{
char a[20];
int l;
printf("Enter String =");
scanf("%s",a);
l=strlen(a);
printf("length of String=%d",l);
getch();
}

--------------------------------------------------------------------

Saturday, 11 February 2012

Program Of Array Of String In C


#include<stdio.h>
#include<conio.h>

          struct student         // Structure Delaration
{
int rollno;
char name[20];
int marks;

} ;
main()
{
int i;
clrscr();
student s1[3];       // Object(s1[]) Array  of  Structure  is Declare
for(i=0;i<3;i++)
{
printf("Enter rollno=");
scanf("%d",&s1[i].rollno);     // Access of  Structure
printf("Enter Name=");
scanf("%s",s1[i].name);
printf("Enter MArks=");
scanf("%d",&s1[i].marks);
}
printf("\n==============  REcord of Student================\n");
for(i=0;i<3;i++)
{

printf("\n Roll Number= %d",s1[i].rollno);
printf("\n Name= %s",s1[i].name);
}
getch();
}

Find String length In C


#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
char a[20];
int l;
printf("Enter String =");
scanf("%s",a);
l=strlen(a);
printf("length of String=%d",l);
getch();
}

Program Of String Lower Case In C


#include<stdio.h>
#include<conio.h>
main()
{
clrscr();
char a[20];
puts("Enter String=");
gets(a);
printf("String In Lower CAe = %s",strlwr(a));
getch();
}

-------------------------------------------------------------------

String Lower Case Used to Convert The Upper Case (capital ) to Lower case.It is the part or type of String.