R
Romram
I was asked to submit atleast 5 solutions for the following problem:
By Replacing/Adding or deleting only one character from the following
code snippet, make it print tttttttttttttttttttt (20 times)
#include<stdio.h>
int main()
{
int k, j=20;
for(k=0;k<j;k--)
printf("t);
printf("\n");
return 0;
}
I came up with 3 solutions which were
1. instead of for(k=0;k<j;k--) write for(k=0;k<j;j--)
2. instead of for(k=0;k<j;k--) write for(k=0;-k<j;k--)
3.instead of for(k=0;k<j;k--) write for(k=0;k+j;k--)
Can anyone suggest me 2 more solutions?
By Replacing/Adding or deleting only one character from the following
code snippet, make it print tttttttttttttttttttt (20 times)
#include<stdio.h>
int main()
{
int k, j=20;
for(k=0;k<j;k--)
printf("t);
printf("\n");
return 0;
}
I came up with 3 solutions which were
1. instead of for(k=0;k<j;k--) write for(k=0;k<j;j--)
2. instead of for(k=0;k<j;k--) write for(k=0;-k<j;k--)
3.instead of for(k=0;k<j;k--) write for(k=0;k+j;k--)
Can anyone suggest me 2 more solutions?