Help with code

[FONT="] [/FONT][FONT="]Given a string and a number ‘n’, find the ‘n’th distinct repeating character. [/FONT]

[FONT="]For example, [/FONT]
[FONT="]Input:[/FONT]
[FONT="]Abracadabra, 1[/FONT]
[FONT="]Abracadabra, 2[/FONT]
[FONT="]Abracadabra, 3[/FONT]
[FONT="]Abracadabra, 4[/FONT]
[FONT="] [/FONT]
[FONT="]Output[/FONT]
[FONT="]a[/FONT]
[FONT="]b[/FONT]
[FONT="]r[/FONT]
[FONT="]null[/FONT]

Replies

  • Bharath51
    Bharath51
    #include
    #include
    #include
    void main()
    {
    char arr[10],c;
    int n,i,count=0;
    clrscr();
    printf("Enter the string:");
    gets(arr);
    printf("enter the position\n");
    scanf("%d",&n);
    c=arr[n];
    i=n-1;
    for(i;i>=0;i--)
    if(arr==c)
    count++;


    if(count>=1 )
    printf("\nnull");
    else
    printf("\n%d",n);


    getch();
    }

You are reading an archived discussion.

Related Posts

Well, what skills, qualities and abilities should be there in a software engineer.😒 What can makes him different from other engineers?
a train passes two cars moving in the direction at 45km/hr and 50km/hr in 36 sec and 54 sec respectively. What is the length of the train?
Hello this is simplycoder, and welcome to the series of C programing tutorials. I request not to post questions or anything in this thread, as it will only disrupt the...
When science goes bad: how impossible is too impossible? | Opinion | The Engineer
If I was a college student, I wouldn't be asking for CS help here, but I'm not a college student, now am I? I need some help with programming theory....