Thread: Noob with super quick question.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Mar 2019
    Posts
    50

    Noob with super quick question.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    
    int main()
    {
    	
    	int age1, age2, age3, average;
    	age1 = age2 = 4;
    	
    	printf("Enter your age.\n");
    	scanf("%d\n", &age1);
    	
    	average = (age1 + age2 + age3) / 3;
    	printf("Group average age: %d\n", average);
    	
    	
    	return 0;
    }
    Ok, in this program, I’m ABSOLUTELY Sure you guys know what I’m trying to do here. Every once in a while though, it seems my compiler is throwing away one of the variables in my equation. When I put 4 as input, it gives 2 as output. Seems like it’s dropping one of the age variables. I’m using cpp compiler on my iPhone as I’m stuck without a computer for a couple months while I save up as my old pc’s mobo went out (RIP, lol). Anyways I ALWAYS try my best to research my issues and only ask for help if I really can’t find it anywhere else. If I did something stupid please be easy on me. I did try to make sure I wasn’t wasting any bodies time, but I’m still pretty brand new at this. Thanks.
    Last edited by Ctylersills; 03-18-2019 at 12:23 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Super NOOB Question of Day
    By andyouf in forum General Discussions
    Replies: 3
    Last Post: 06-05-2014, 06:17 AM
  2. quick noob question
    By thanatos1 in forum C# Programming
    Replies: 2
    Last Post: 06-17-2009, 08:28 PM
  3. super noob question
    By verbity in forum C++ Programming
    Replies: 6
    Last Post: 06-23-2007, 11:38 AM
  4. Hello everyone, super noob!
    By TiznaraN in forum C++ Programming
    Replies: 14
    Last Post: 09-30-2006, 11:29 PM
  5. Super quick ? here
    By CAP in forum C Programming
    Replies: 9
    Last Post: 08-03-2002, 12:35 PM

Tags for this Thread