I need help

0 Ash Marz · November 24, 2014

#include <stdio.h>
#include <stdlib.h>

int main()

  char me[20];
  char me2[20];
  char you[20];
  char you2[20];
  printf("Who are you: \n");
scanf("%s %s", me,me2);

printf("Where do you live: \n");
scanf("%s %s", you, you2);

float a;
float b;
float c;
float avg;

printf("Enter value for a\n");
scanf("%f", &a);
printf("Enter value for b\n");
scanf("%f", &b);
printf("Enter value for c\n");
scanf("%f", &c);
avg = (a+b+c)/3;
printf("The average number is %.2f",avg);

    return 0;

can you please help me , I dont know why this code isnt working

Post a Reply


Oldest  Newest  Rating
0 Franz Schmidt · November 24, 2014
Could you please explain what exactly the program is going to do so we can help you with your problem?
What exactly doesn't work in your code?

I tried your code and everything seems nice to me:ermm: 
0 Nenad Zelenovic · November 24, 2014
Change float into double and you can use %lf.
0 Ash Marz · November 25, 2014
the problem is that the average value is not working
0 Franz Schmidt · November 25, 2014
What output do you get some? Random numbers? Negative numbers? Big or small?
Be a little bit more detailed please.
  • 1



One of the most popular languages of all time.

Bucky Roberts Administrator