Posts

Showing posts with the label C programming

Q. Write a program to get two different array values , merge them and finally produce the ascending order sorting of the result. (array Concept)-C programming

Image
Array Concept:   Program: #include < stdio.h > #include < conio.h > void main() {     int a[25],b[25],n,g=0,m,i,j,c,temp;     clrscr();     printf (" Enter the number of a: ");         scanf("%d",&n);     printf ("\n Enter the no of b: ");         scanf("%d",&m);     printf ("\n Enter a values \n");     for ( i=1; i<=n ; i++ )         scanf("%d",&a[i]);     printf ("\n Enter b values \n");     for ( j=1; j<=m ; j++ )     {         scanf("%d",&b[j]);         a[i]=b[j];         i++;     }     printf ("\n Merged values: \n");     c=n+m;     for ( i=1; i<=c; i++ )  ...

Q. write a program to accept a string and find out whether it is palindrome or not using pointer. ( C programming )

Image
Palindrome using pointer: Solution: #include < stdio.h > #include < conio.h > #include < string.h > void main() {     int c=0,d;     char str[30];char *a,*b;     clrscr();     printf (" Enter the string: ");        scanf("%s",str);     a=str;     for (a=str; *a!='\0';a++);     --a;       printf (" a points last character now: %c",*a);     for (b=str; *b==*a; b++)     {        c=c+1;        --a;     }     printf ("c:%d",c);     d=strlen(str);     if (c==d)              printf ("\n Given String is Palindrome ");     else           ...