Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C by leszek ( 14 years ago )
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int i,N;
    char *t;
    char *t2;
    printf("Podaj dlugosc napisu ");
    scanf("%d",&N);
    N+=1;
    t=(char*) malloc (N*sizeof(char*));
    t2=(char*) malloc (N*sizeof(char*));

    /*Łańcuch pobrany*/
    printf("Wczytaj lancuch ");
    for (i=0; i<N; i++)
         {
             scanf("%c", &t[i]);
         }

    printf("\n Lancuch pobrany: ");
    for (i=0; i<N; i++)
        {
            printf("%c",t[i]);
        }

    /*Łancuch utworzony*/

    for (i=0; i<N; i++)
        {
            t2[i]=t[i];
        }

    printf("\n\n Lancuch utworzony \n");

    for (i=0; i<N; i++){
        if (i%2==1) {printf("%c",t2[i]);}
    }
    printf("\n\n%c",t2[i]);
   free(t);
   free(t2);
}

 

Revise this Paste

Your Name: Code Language: