Help with code

raj.kmolkar

raj.kmolkar

@rajkmolkar-4Q6h5q Oct 25, 2024
[FONT=&quot] [/FONT][FONT=&quot]Given a string and a number ‘n’, find the ‘n’th distinct repeating character. [/FONT]

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

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Bharath51

    Bharath51

    @bharath51-UnF02G Aug 21, 2011

    #include<stdio.h>
    #include<conio.h>
    #include<string.h>
    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();
    }