1 solutions

  • 0
    @ 2025-11-5 17:14:08

    C :

    #include<stdio.h>
    #include<stdlib.h>
    #include<string.h>
    void fun(char a[],char b[],int n)
    {
        int i,j=0;
        for(i=0;i<strlen(a);i++)
    
    	{
            if(i!=n)
            {
                b[j]=a[i];
                j++;
            }
    	}
        b[j]='\0';
    }
    int main()
    {
        char x[100],y[100];
        int n;
        while(scanf("%s%d",x,&n)!=EOF)
        {
            fun(x,y,n);
            printf("%s\n",y);
        }
    
    	return 0;
    }
    
    

    C++ :

    #include <stdio.h>
    #include <math.h>
    #include <stdlib.h>
    #include <time.h>
    #include <string.h>
    #include<algorithm>
    #include<iostream>
    using namespace std;
    void fun(char a[],char b[],int n)
    {
        int i,j=0;
        for(i=0;i<strlen(a);i++)
            if(i!=n)
            {
                b[j]=a[i];
                j++;
            }
        b[j]='\0';
    }
    
    int main()
    {
       // freopen("in","r",stdin);
      // freopen("out","w",stdout);
    
    
        char x[100],y[100];
        int n;
        while(scanf("%s%d",x,&n)!=EOF)
        {
            fun(x,y,n);
            printf("%s\n",y);
        }
    
    
    	return 0;
    
    }
    
    
    • 1

    Information

    ID
    18216
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By