Thread: Printing just even numbers from user input values.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    11

    Printing just even numbers from user input values.

    I have one last problem, the catch here is to not use arrays:

    Here's the problem:

    [spoiler]
    Write a C program to prompt the user to enter five random integers from the keyboard and print only the even numbers. Also print the sum of the even numbers. The integers may be positive or negative.
    [/spoiler]

    My attempt:
    Code:
    #include<stdio.h>
    #include<conio.h>
    int main();
    {
    int a,b,c,d,e;
    
    
    scanf("%d%d%d%d%d",a,b,c,d,e);
    
    
    if (a%2==0)
    p
    .....
    I'm lost from this point and just need some hints/help on what to do to store values that are even and display them in a loop, then add them.
    Last edited by tadm123; 10-03-2012 at 05:22 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Printing out previously entered user input!
    By SimarGill in forum C Programming
    Replies: 9
    Last Post: 12-04-2011, 10:19 PM
  2. Structure, user input and printing out results
    By alvarito in forum C Programming
    Replies: 3
    Last Post: 10-04-2011, 11:04 AM
  3. Printing a Solid Square based on user input
    By ThatBoy1124 in forum C Programming
    Replies: 3
    Last Post: 03-01-2011, 10:07 PM
  4. Printing asterisks using user input
    By celticpride in forum C Programming
    Replies: 4
    Last Post: 02-10-2011, 09:43 PM
  5. How to let the user input values for an array...
    By TerranAce007 in forum C++ Programming
    Replies: 2
    Last Post: 08-24-2002, 03:54 AM