Code:
#include <stdio.h>
int main()
{
int i;
int max;
scanf("%d%*c", &max);
while(max <= 10 && max >=2)
{
for(i = 1; i < max; i++)
{
printf("%d", i);
}
printf("%d\n");
max--;
}
return(0);
}
This gives me the right answer except it produces a 0 at the end of each line.
Code:
#include <stdio.h>
int main()
{
int i;
int max = 10;
while(max <= 10 && max >=2)
{
for(i = 1; i < max; i++)
{
printf("%d", i);
}
printf("\n");
max--;
}
return(0);
}
This is my final code which produces the right result. Can anyone tell me if it looks ok? and if there is anything i need to modify. Cheers.