Print Prefix
#include <iostream>
using namespace std;
#include<cstring>
void printprefix(char input[]){
int len=strlen(input);
for(int i=0;input[i]!='\0';i++){
for(int j=0;j<=i;j++){
cout<<input[j];
}
cout<<endl;
}
}
// Write your code here
int main() {
// Write C++ code here
char str[100]="abcd";
printprefix(str);
return 0;
}
Comments
Post a Comment