1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Prints n x n pattern of symbols in the shape of large U

Discussion in 'C++' started by kishore30, Jul 10, 2010.

  1. kishore30

    kishore30 New Member

    Joined:
    Jul 9, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    hai i am kishore...i need some help for my C++ assignment....please...this is the questions...

    no1) using C++,write a program to prints an n x n pattern of symbols in the shape of a large U. for example,if users enters 6 for n the program should print the following picture.

    output:
    * *
    * *
    * *
    * *
    * *
    ******

    no2) write C++ program when a number entered it will display in reverse order. the program only accept positive numbers if not terminate the program. given below sample outputs.

    output:

    a)enter a number greater than 0: -1
    illegal.
    press any key to continue...

    b) enter a number greater than 0 :25
    52
    press any key to continue...

    no3) in mathematics, a prime number is natural number that has exactly two distinct number divisors: 1 and itself. write a C++ program when a user enters number,the program will identify whether it is prime number or not. it will display a message indicate if it is not a prime number with its factorial. the program only accepts any number greater than 1,other than that it will terminate the program. given below sample outputs.

    output:

    a) enter an integer greater than than 1: 25
    your number is not prime. it has a factor: 5
    press any key to continue....

    b) enter a integer number greater than 1: 7
    your number is prime.
    press any key to continue....

    4)write a program that asks the user for a letter from the alphabet and then prints out the next character in the alphabet.take account of both upper and lower case characters, and if the user enters 'z' or 'Z' then return 'a' or 'A',respectively. the program will loop continuously,until the user indicates the program should terminate. a sample run of the program follows.

    output:
    Hi! i'm a clever computer program that knows the alphabet.
    please enter a letter: a
    the next letter is b

    do you want to enter another letter <y = yes and n = no>? y
    please enter a letter:A
    the next word is B.

    Do you want to enter another letter <y = yes and n = no>? y
    please enter a letter:Z
    the next letter is A.

    Do you want to enter another letter <y = yes and n = no>? n
    Goodbye!
    Press any key to continue....

    these are the questions. please help me with the answer....i need it as fast as possible. i will really appreciate your help.thank you very much.:)
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    Moved from C to C++ Programming Forum
     

Share This Page