logic - WAP in C or java: Consider two char arrays, "abcdefg" and "xyz"...the output must print "axbyczdefg" -
consider 2 char arrays, "abcdefg" , "xyz".
the output must print "axbyczdefg", please i've been stuck on since morning.
#include <stdio.h> #include <conio.h> void main() { int i,j; char a[]="abcdefg"; char b[]="xyz"; for(i=0;i<=6;i++) { printf("%c",a[i]); for(j=0;j<=i;j++) { printf("%c",b[j]); } } }
like this
#include <stdio.h> int main(void) { const char *a = "abcdefg"; const char *b = "xyz"; while(*a || *b){ if(*a) putchar(*a++); if(*b) putchar(*b++); } }
Comments
Post a Comment