1,780
20
Essay, 1 pages (200 words)

Computer programming

COMPUTER PROGRAMMING ASSIGNMENT NAME: MEHR-UN-NISA ROLL NUMBER: SP12-BET-037 DATE: 23/10/2012 SUBMITTED TO: SIR USMAN YASEEN Write the following programs that takes the size as an integer from the user and displays the shapes (given below) with the help of asterisks. 1. Size= 7(base and perpendicular have 7 asterisk) * ** *** **** ***** ****** ******* PROGRAM: #include #include int main() { int i, j, n; printf(” enter number”); scanf(“%d”,&n); for(i= 1; i <= 7; i++) { for(j= 0; j #include int main () { int i, j, k, l, n; printf (” enter size”); scanf (“%d”,&n); l= n-1; for (i= 0; i <= n; i++) { for (k= l; k>= i; k–) { printf(” “); } for (j= 0; j <= i-1; j++) { printf ("*"); } printf (""); } getch(); return 0; } 3. Size= 7(base and perpendicular have 7 asterisk) ******* ****** ***** **** *** ** * PROGRAM: #include #include int main() { int i, j, n; printf(” enter size”); scanf(“%d”,&n); for(i= 8; i> 1; i–) { for(j= 1; j #include int main() { int i, j, k, n; printf(” enter size”); scanf(“%d”,&n); for(i= 7; i>= 1; i–) { for(j= 7-i; j>= 1; j–) { printf(” “); } for(k= 1; k <= i; k++) { printf("*"); } printf(""); } getch(); return 0; } 5. Size= 7(base has 7 asterisk) * *** ***** ******* PROGRAM: #include #include main () { int i, j, k, l, n; printf (” enter size”); scanf (“%d”,&n); l= n-1; for (i= 0; i <= n; i++) { if (i%2!= 0) continue; for (k= l; k>= i; k–) { if (k%2!= 0) continue; printf(” “); } for (j= 0; j <= i; j++) { printf ("*"); } printf (""); } getch(); return (0); }

Thank's for Your Vote!
Computer programming. Page 1
Computer programming. Page 2

This work, titled "Computer programming" was written and willingly shared by a fellow student. This sample can be utilized as a research and reference resource to aid in the writing of your own work. Any use of the work that does not include an appropriate citation is banned.

If you are the owner of this work and don’t want it to be published on AssignBuster, request its removal.

Request Removal
Cite this Essay

References

AssignBuster. (2022) 'Computer programming'. 14 September.

Reference

AssignBuster. (2022, September 14). Computer programming. Retrieved from https://assignbuster.com/computer-programming/

References

AssignBuster. 2022. "Computer programming." September 14, 2022. https://assignbuster.com/computer-programming/.

1. AssignBuster. "Computer programming." September 14, 2022. https://assignbuster.com/computer-programming/.


Bibliography


AssignBuster. "Computer programming." September 14, 2022. https://assignbuster.com/computer-programming/.

Work Cited

"Computer programming." AssignBuster, 14 Sept. 2022, assignbuster.com/computer-programming/.

Get in Touch

Please, let us know if you have any ideas on improving Computer programming, or our service. We will be happy to hear what you think: [email protected]