Can someone check my work?

+1 Bugra Akyol · February 2, 2015

Can someone check my work? And if you have advices to make it better please tell me.

Work link:

LAB WORK 1: Firstly, your program wants from user an integer (int) and two floating point
numbers (f1,f2). After user enter all the inputs, 
If integer less than 0, your program should compares f1 and f2 and write the result as convenient one of the following:
“ Valuef1 is greater than Valuef2 ”
“ Valuef2 is greater than Valuef1 ”
“ Valuef1 is equal to Valuef2 ” Note: Max 3 digits for fractional part of floating point numbers ? If 0 ? int ? 10, your program should want name and surname (max 15 character for each) from the user and print on the screen as following:
“ Name = ……………….”
“Surname = …………….”
If int > 10,your program should print the message “Valueint is greater than 10” And finally your program should calculate the average of the entered numbers (integer and floating point numbers) and print on the screen as following:
“The average of the entered number = ….”

My code:

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

int main()


int a;
float f1,f2,avg;
char name[15];
char surname[15];

printf("Enter an integer and two floating point numbers: \n");
scanf("%d %f %f", &a, &f1, &f2);

printf("%.3f is greater than %.3f\n", f1, f2);

}else if(f2>f1){
printf("%.3f is greater than %.3f\n", f2, f1);;

printf("%.3f is equal to %.3f\n", f1, f2);

}else if(0<=a && a<=10){
printf("Enter name: \n");
printf("Enter surname: \n");

printf("\"Name= %s\"\n\"Surname= %s\"\n",name,surname);
printf("%d is greater than 10\n",a);

printf("\"The average of the entered numbers= %.3f\"",avg);

return 0;


Post a Reply


Oldest  Newest  Rating
0 osh Ranw · February 2, 2015
0 Bugra Akyol · February 2, 2015
@c student 

0 Bugra Akyol · February 3, 2015
@c student 
I thought +1 for storage so 17. I am not sure
0 J show · February 3, 2015
Whats your course title? I'm taking a C programming class right now as well. The program look similar to what we've been doing.
0 Bugra Akyol · February 5, 2015
@Josh Showalter
Josh Showalter

Its my universities working page. I am not taking the lesson right now. But trying to learn before..
You can find the other works on 
Check it out
0 J show · February 8, 2015
I'll have to check it out my lab was creating the factorial function and applying it and then creating a reverse number function and applying it in the main function this week. 
  • 1



One of the most popular languages of all time.

Bucky Roberts Administrator