Thread: Need help for this 3 programs in C.

  1. #1
    Registered User
    Join Date
    Oct 2011

    Need help for this 3 programs in C.

    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.

    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

    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
    What have you tried?
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Oct 2011
    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
    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.

    Hope is the first step on the road to disappointment.

  5. #5
    casual coder spaghetticode's Avatar
    Join Date
    Jan 2011
    Hesse, Germany
    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, 07:03 AM
  2. GUI programs with C?
    By arya6000 in forum C Programming
    Replies: 7
    Last Post: 11-04-2007, 10:27 PM
  3. TCP/IP Programs
    By GVSyam in forum Linux Programming
    Replies: 1
    Last Post: 04-01-2003, 05:24 AM
  4. Programs opening programs
    By LinuxPLC in forum C Programming
    Replies: 1
    Last Post: 11-21-2002, 12:50 PM
  5. My best C++ Programs
    By Paro in forum C++ Programming
    Replies: 113
    Last Post: 03-24-2002, 11:52 AM