Irishpride<3
[√] Flameworthy
+76|5515|Baile Atha Cliath, Éire
#include <stdio.h>


int main()

{

int age ;

printf ("Enter the person's age: ") ;
    scanf ("%d", age) ;
        fflush(stdin) ;

if (age <0 && >10)
    printf ("The persons age is:%d.Person is a child", age) ;
        else
if (age <11 && >19)
    printf ("The persons age is:%d. Person is a teenager", age) ;
        else
if (age <20 && >29)
    printf ("The persons age is:%d. Person is in there twenties", age) ;
        else
if (age <30 && >39)
    printf ("The persons age is:%d. Person is in there thirties", age) ;
        else
if (age >40)
    printf ("The persons age is:%d. Person is old and dieing", age) ;

return 0 ;
}

It says "Error before '>' token"

What am I doing wrong?
S3v3N
lolwut?
+685|6733|Montucky
everything

Last edited by S3v3N (2009-11-24 11:52:50)

Irishpride<3
[√] Flameworthy
+76|5515|Baile Atha Cliath, Éire
#include <stdio.h>


int main()

{

int age ;

printf ("Enter the person's age: ") ;
    scanf ("%d", age) ;
        fflush(stdin) ;

if (age >0 && age <10)
    printf ("The persons age is %d \nPerson is a child", age) ;
        else
if (age >11 && age <19)
    printf ("The persons age is %d \nPerson is a teenager", age) ;
        else
if (age >20 && age <29)
    printf ("The persons age is %d \nPerson is in there twenties", age) ;
        else
if (age >30 && age <39)
    printf ("The persons age is %d \nPerson is in there thirties", age) ;
        else
if (age >40)
    printf ("The persons age is %d \nPerson is old and dieing", age) ;

return 0 ;

}
Irishpride<3
[√] Flameworthy
+76|5515|Baile Atha Cliath, Éire
https://i171.photobucket.com/albums/u288/Irishpride2/fu.jpg

lol, epic fail.
chuyskywalker
Admin
+2,439|7062|"Frisco"

Code:

#include <stdio.h>

int main()

{
    int age ;

    printf("Enter the person's age: ");
    scanf("%d", &age);
    fflush(stdin);

    printf("The persons age is %d \n", age) ;

    if (age >= 0 && age <= 10)
        printf("Person is a child");

    if (age >= 11 && age <= 19)
        printf("Person is a teenager");

    if (age >= 20 && age <= 29)
        printf("Person is in their twenties");

    if (age >= 30 && age <= 39)
        printf("Person is in their thirties");

    if (age >= 40)
        printf("Person is old and dieing");

    // be nice and cleanup
    printf("\n");

    return 0 ;

}
I have never written C code before.

Board footer

Privacy Policy - © 2024 Jeff Minard