sami sam

sami sam

  • NA
  • 40
  • 30.2k

Explanation needed for C Programme output !!?

Aug 12 2012 7:53 AM
Could someone please explain for me why we got output: CPormn-end 
The programme is below:


 #include <stdio.h>

#include <string.h>

 

char s[80];

int i, j;

 

int main() {

   strcpy(s, "C Programming");

   i = 0;

   j = strlen(s) - 1;

   while (i < j) {

      if (s[i] != s[i+1]) {

         printf("%c",s[i]);

         i = i + 2;

      } else {

         i++;

      }

   }

   printf("-end\n");

}


Answers (1)