Top-Rated Free Essay
Preview

Abbdbd

Good Essays
355 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Abbdbd
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<stdio.h>
#include<conio.h> int main()
{
int i,j,n; printf("enter number"); scanf("%d",&n); for(i=1; i<=7; i++) { for(j=0; j<i; j++) printf("*"); printf("\n"); } getch(); return 0; }

2. Size=7(base and perpendicular have 7asterik) * ** *** **** ***** ******
*******
PROGRAM:
#include <stdio.h>
#include <conio.h> 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 ("\n"); } getch(); return 0;
}

3. Size=7(base and perpendicular have 7 asterisk)
*******
******
*****
****
***
**
*
PROGRAM:
#include<stdio.h>
#include<conio.h> int main()
{
int i,j,n; printf("enter size"); scanf("%d",&n); for(i=8; i>1; i--) { for(j=1; j<i; j++) printf("*"); printf("\n"); } getch(); return 0; }

4. Size=7(base and perpendicular have 7 asterisk)
*******
****** ***** **** *** ** * PROGRAM:
#include <stdio.h>
#include<conio.h>
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("\n"); } getch(); return 0; }

5. Size=7(base has 7 asterisk) * *** *****
*******
PROGRAM:
#include <stdio.h>
#include <conio.h> 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 ("\n");
}
getch(); return (0);
}

You May Also Find These Documents Helpful

  • Satisfactory Essays

    PT1420 Unit 8 Lab 8

    • 365 Words
    • 2 Pages

    Step 2: Explain what you think will be displayed to the screen in Step 1. (Reference: For…

    • 365 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    unit 7 assignment 1

    • 431 Words
    • 2 Pages

    7. Convert the While loop in the following code to a Do-While loop: int x;…

    • 431 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Comp3652 Unit 2 Assignment

    • 1090 Words
    • 5 Pages

    b. Use your interpreter to create a new fractal program. See whether you can create something…

    • 1090 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    1) Numbers can be represented in binary (using 2 symbols 0 and 1) and hexadecimal ( 16 symbols…

    • 480 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Pt1420 Unit 7 Study Guide

    • 582 Words
    • 3 Pages

    2.Write a program to (a) display a “?” (b) read two decimal digits whose sum less than 10 (c) display them and their sum on the next line. Page: 80…

    • 582 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    BRSB

    • 562 Words
    • 3 Pages

    Patient X is a 52-year-old man who lives in Bowen Hills, Brisbane. He is an automotive repair man. However, he has recently lost his job and has stayed idle for one year. Recently, he was playing basketball with his eldest son and suddenly developed a substernal chest pressure. When he thought it was just a typical ‘heartburn’, he continued playing. After another 20 minutes, he had an intolerable sharp, nagging chest pain. His left arm became numb. His son verbalised that he looked pale and was sweating a lot. His son called the paramedics which accordingly arrived after 30 minutes and he was brought to Royal Brisbane and Women’s Hospital.…

    • 562 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    unit 8 homework

    • 793 Words
    • 5 Pages

    3. Design a For loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 . . . 1000…

    • 793 Words
    • 5 Pages
    Good Essays
  • Good Essays

    Bb's Quizlet

    • 147 Words
    • 1 Page

    B.S.S. is incorrect about their ideas of cutting off our lunch because first off we do not have enough time in the day for everything so lunch is the time to finish everything B.S.S. also promotes clubs during lunch so we will have no time to participate in any clubs if they cut our lunch off even more which is which is what they intend to do…

    • 147 Words
    • 1 Page
    Good Essays
  • Good Essays

    Abcd

    • 455 Words
    • 2 Pages

    In Parvana’s journey the children are the only hope for Afghanistan s future. Do you agree?…

    • 455 Words
    • 2 Pages
    Good Essays
  • Good Essays

    B. A. B Rr

    • 364 Words
    • 2 Pages

    The term F.U.B.A.R originated in World War Two and was used as a military acronym by United States soldiers. During World War Two, F.U.B.A.R was used to describe the chaos and bedlam involved with trench warfare. It is unknown what word the term originated from, but it is suspected that it comes from the German word Furchtbar, which means terrible. F.U.B.A.R can be translated into two ways, Fucked Up Beyond All Repair, and Fucked Up Beyond All Recognition. Despite having slightly different connotations, both translations essentially mean the same thing. F.U.B.A.R is now an official military acronym used in order to deem a situation (or target) as utterly destroyed. Similarly, Fubar is a slang term which means botched, ruined, or completely messed up.…

    • 364 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Fdgdbh

    • 368 Words
    • 2 Pages

    Referring to examples, assess the potential for water conflict in areas where demand exceeds supply.…

    • 368 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    bbsdsdg

    • 1562 Words
    • 7 Pages

    Labs: Refer to the Laboratory Supplement for general information on laboratory work and lab reports.…

    • 1562 Words
    • 7 Pages
    Good Essays
  • Good Essays

    Chapter 6 solutions

    • 4145 Words
    • 41 Pages

    b. Modify the reverse-display program so that the user can enter up to 10 numbers…

    • 4145 Words
    • 41 Pages
    Good Essays
  • Good Essays

    C++ Midterm

    • 2831 Words
    • 12 Pages

    What is the value inside the "value" variable at the end of the given code snippet?…

    • 2831 Words
    • 12 Pages
    Good Essays
  • Satisfactory Essays

    //casestudy 1 the drunken cockroach/*start of the program*/#include<stdio.h>#include<conio.h>#include<stdlib.h>#include<dos.h>void main(){int iteration,sizerow,sizecol,imove[8],jmove[8],k,ibug,jbug,a,b,legal=0,boundaryrow,boundarycol,move=0,count[40][40]={0};char tile[40][40];clrscr();printf("The Drunken Cockroach Simulator!\n");printf("Note:\nSometimes this cockroach steps on the already stepped tiles because its drunken");printf("\n'S' - stands for the starting point \n'C' - stands for the stepped tiles \n'Q' - stands for unwalkable tiles");printf("\nInput the size of the room you want (row,column): ");scanf("%d,%d",&sizerow,&sizecol);printf("Input the cockroach's starting point (row,column): ");scanf("%d,%d",&jbug,&ibug);printf("Input…

    • 93 Words
    • 1 Page
    Satisfactory Essays