Friday, December 30

//c program sum of two string//

#include
#include
#include

void main()
{
   char a[100], b[100];

   printf("Enter the first string\n");
   gets(a);

   printf("Enter the second string\n");
   gets(b);

   strcat(a,b);

   printf("String obtained on concatenation is: %s\n",a);

   getch();
}

//c program matching o two strings//

#include
#include

main()
{
   char a[100], b[100]="ruet";


   printf("Enter the first string\n");
   gets(a);



   if( strcmp(a,b) == 0 )
      printf("Entered strings are matched.\n");
   else
      printf("Entered strings are not matched.\n");
getch();
}

//c program replacing space by star//

#include
#include


void main(){
int i,l;
char c[100];
gets(c);
l=strlen(c);

for (i=0 ; i    {if (c[i]==32)
        c[i]=42;}
puts(c);

getch();
}

//c program for ascii value of a character//


#include
void main()
{
int a;
printf("ENTER THE CHARACTER\n");
a=getchar();
printf("THE ASCII VALUE OF CHARACTER is %d\n",z);
}

//c program for piramid//



#include
int main()
{
    int counter,x,y,z;
        counter=0;
    for(x=15;x>=1;x--)
    {
        for(y=1;y<=x;y++)
        {
            printf(" ");
        }
                counter=counter+1;
            for(z=1;z<=counter;z++)
                {printf("* ");}
                printf(" \n");}
return 0;
}