Hi Divya, Please find the below code, ========================================= #include
int main () { int i = 0, j; char *asterisc = "*"; printf ("How many times you want to print the * ????\n"); scanf ("%d", &j); printf ("printing %d asterisc\n", j); for (; i<j; i++) { printf ("%s\n", asterisc); } return 0; } /* [ccplusplus@rhel6x64 c]$ gcc print_asterisc.c -o print_asterisc [ccplusplus@rhel6x64 c]$ ./print_asterisc How many times you want to print the * ???? 5 printing 5 asterisc * * * * * [ccplusplus@rhel6x64 c]$ */ ==================================================
Sorry Readers, The header was putted accidentally as I was checking for windows compatibility. It is removed now.
ReplyDeletecan you suggest me how to print like the below
ReplyDelete*
*
*
*
*
*
*
Hi Divya,
DeleteYour requested will be provided by tomorrow EOD. Kindly wait till that.
Thanks.
ccplusplus - support
Hi Divya,
DeletePlease find the below code,
=========================================
#include
int main ()
{
int i = 0, j;
char *asterisc = "*";
printf ("How many times you want to print the * ????\n");
scanf ("%d", &j);
printf ("printing %d asterisc\n", j);
for (; i<j; i++)
{
printf ("%s\n", asterisc);
}
return 0;
}
/*
[ccplusplus@rhel6x64 c]$ gcc print_asterisc.c -o print_asterisc
[ccplusplus@rhel6x64 c]$ ./print_asterisc
How many times you want to print the * ????
5
printing 5 asterisc
*
*
*
*
*
[ccplusplus@rhel6x64 c]$
*/
==================================================
1111111
ReplyDelete1A1AAAA
1AA1AAA
1AAA1AA
1AAAA1A
1AAAAA1
1111111
1111111
ReplyDelete1A1AAAA
1AA1AAA
1AAA1AA
1AAAA1A
1AAAAA1
1111111