#include<stdio.h>
 

void main()
{ int i=1,j=1,n=9;
printf("enter the char");
scanf("%d",&n);

while(i<=n)
{
while(j<=i)
{
printf("%d/0",i);
j++;
}
printf("/n");
i++;
}
 
}

OUTPUT
1
22
333
4444
55555

Recommended Answers

All 5 Replies

what do u mean by 'enter the char' and read it as an integer.

/0,/n are wrong
use \0 and \n.
hope u r aware about it, but by a mistake??

thanks dude,but though the mistakes uve told arent syntax errors arent they
i ment "im not able to get oput"
in the sense i am not able to execute the program
and during compilation it gives no error

I think this code helps you

#include<stdio.h>


void main()
{ int i=1,j=1,n=9;
printf("enter the No");
scanf("%d",&n);

while(i<=n)
{
while(j<=i)
{
printf("%d\0",i);
j++;
}
printf("\n");
i++;
j=1;
}

}

Do u expect this?

@hsetaknev

line 4:

void main()

main always returns a int value so it must be

int main()

line 5:
when you are asking to the user for the value of n then
no need to initialize n=9.
line 13:
could'nt unserstand the need of /0 here even its \0.. no need for it.
line 16:
Its '\n' not '/n'.
Line 19:
place

return 0;

Post your code in proper format..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.