Like Tree1Likes
  • 1 Post By quzah

Need help for this 3 programs in C.

This is a discussion on Need help for this 3 programs in C. within the C Programming forums, part of the General Programming Boards category; 1. Write a program that will print all prime numbers from a given range which consist of only odd digits. ...

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    5

    Need help for this 3 programs in C.

    1.
    Write a program that will print all prime numbers from a given range which consist of only odd digits. At the end to print the number of primes which satisfy the condition.

    i can use only stdio.h not conio or anything else.

    2.
    Write a program for each of the numbers are printed after the number of transformations that the original number becomes single digits, and print thereceived transformed number. With each transformation of the original number, it is replaced by the sum of its digits.

    Example: 721->10->1

    3.
    To write a program that print diamond asterisks (*). Diamond should have 2 * N - 1 queues, where N is read from the keyboard.
    Example: For N = 3 print

    --*
    -***
    *****
    -***
    --*
    Last edited by CnikolaC; 10-27-2011 at 09:19 PM.

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,310
    What have you tried?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Oct 2011
    Posts
    5
    i only know the algorithm for the first one
    int i,j,r1,r2,c=0
    for i=r1;i<=r2;i++
    for j=2;j<=i/2;j++

    i am beginner in this so i don't know much.
    for the second and third programs i have no die how to start.
    So if you or anyone else can write them i will be very thakfull

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Stop trying to write programs, and start trying to write out into words what you need to do for each one. Turn your words into a list of things to do. If you can't recreate the output from reading your list, then you have done it wrong. Then turn that into pseudo-code.


    Quzah.
    dennis.cpp likes this.
    Hope is the first step on the road to disappointment.

  5. #5
    language hopper dennis.cpp's Avatar
    Join Date
    Jan 2011
    Location
    Herborn, Hesse, Germany
    Posts
    197
    Quote Originally Posted by laserlight View Post
    What have you tried?
    Couldn't the admins implement a function to add the above quote and the OPs answer to it beneath the first posting of a homework thread automatically? The first three postings are always the same anyway...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 11-09-2009, 06:03 AM
  2. GUI programs with C?
    By arya6000 in forum C Programming
    Replies: 7
    Last Post: 11-04-2007, 09:27 PM
  3. TCP/IP Programs
    By GVSyam in forum Linux Programming
    Replies: 1
    Last Post: 04-01-2003, 04:24 AM
  4. Programs opening programs
    By LinuxPLC in forum C Programming
    Replies: 1
    Last Post: 11-21-2002, 11:50 AM
  5. My best C++ Programs
    By Paro in forum C++ Programming
    Replies: 113
    Last Post: 03-24-2002, 10:52 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21