#task:input a number “n” and a string ,then shift the string
1.example:
hello
2
output:
llohe
2.question:
how to sovle When n is greater than the length
#include <stdio.h>
#include <string.h>
int main() {
char s[110];
gets(s);
int n;
scanf("%d",&n);
for(int i = n;s[i] != '';i++) {
printf("%c",s[i]);
}
for(int i = 0;i<n;i++) {
printf("%c",s[i]);
}
return 0;
}
how to sovle When n is greater than the length
New contributor
jay is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.