Quote Originally Posted by laserlight View Post
You need to format your code properly, especially with respect to indentation. It is also better that you post your code as plain text, allowing the forum software to do the syntax highlighting for you. For example:
Code:
#include<stdio.h>

int main() {
    int opcion;

    printf("1.Capturar datos de la Empresa\n");
    printf("2.Mostrar datos de la empresa\n");
    printf("3.Edades de los empleados\n");
    printf("4.Salir\n");
    printf("\n");

    while (opcion != 4) {
        int edad;
        int mayores = 0;
        int maduros = 0;
        int jovenes = 0;

        char siono = 'y';
        char salir = 'n';

        printf("opcion: ");
        scanf("%d", &opcion);
        printf("\n");

        char nombreEmpresa[60];
        char giro[60];

        switch (opcion) {
        case 1:
            printf("Nombre de la empresa:");
            scanf("%s",nombreEmpresa);
            printf("Giro de la empresa:");
            scanf("%s",giro);
            printf("\n");
            break;
        case 2:
            printf("Nombre de la empresa:%s", nombreEmpresa);
            printf("\nGiro: %s",giro);
            printf("\n\n");
            break;
        case 3:
            while (siono != 'n') {
                printf("Escriba la edad de los empleados: ");
                scanf("%d", &edad);
                if (edad < 0) {
                    printf("Error");
                }
                else if(edad > 65) {
                    printf("Error\n\n");
                }
                else if(edad >= 50) {
                    mayores++;
                }
                else if(edad >= 22) {
                    maduros++;
                }
                else if(edad >= 18) {
                    jovenes++;
                }
                else {
                    printf("Error\n\n");
                }

                printf("Desea ingresar otra edad? y/n ");
                scanf ("%s", &siono);
                printf("\n");
            }
            printf("Mayores: %d\n", mayores);
            printf("Maduros: %d\n", maduros);
            printf("Jovenes: %d\n", jovenes);
            printf("\n");
            break;
        case 4:
            while (salir !='y') {
                printf("Realmente desea salir? y/n ");
                scanf("%s", &salir);
                if (salir == 'n') {
                    salir = 'y';
                    opcion = 5;
                    printf("\n");
                }
            }
            break;
        default:
            printf("\n");
            break;
        }
    }
    return 0;
}
Notice that now it is easier to see where the if statements, loops, the switch, etc, start and end. I have also removed the many unnecessary blank lines: a blank line or two (or sometimes even three at file scope) might be used to visually break parts of the code to group parts that logically belong together, but there is definitely no need to use more than three blank lines for this.

One problem I see is that you use the opcion variable in the outer loop before giving it a value.

thank you, you are right is its quite easier to read , ill take better care of indentation from now on.
i also initialized opcion to 0 , but the problem i have with the program is that it just wont display jovenes value it alway shows 0 when printed on the screen.