Tuesday, December 6, 2011

Write a C Program to find string length and find charecter position

#include <stdio.h>
#include <conio.h>
#include <string.h>
void main()
{
 char a[25],e;
 int b,d,c;
 clrscr();
 printf("Enter A string: ");
 gets(a);
 b=strlen(a);
 printf("The length of your entered string is %d",b);
 printf("\nIf you check position of charecters press:1:: ");
 scanf("%d",&c);
 if(c==1)
 {
  printf("\nplease enter your charecter position (Charecter Position started form 0): ");
  scanf("%d",&d);
  printf("The charecter of your string position is %c",a[d]);
 }
 getch();
}

No comments:

Post a Comment