Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,166,274 members, 7,864,403 topics. Date: Tuesday, 18 June 2024 at 05:35 PM

Rawplantain's Posts

Nairaland Forum / Rawplantain's Profile / Rawplantain's Posts

(1) (of 1 pages)

Programming / Re: Help With C by rawplantain: 4:08pm On Nov 12, 2016
timtoday:
What is wrong with your code:

1. Check how you are using the function
scanf(...)

remove the newline
"\n"
you are using. scanf is not the same as printf, though they might be similar.

2. Why is your average though declared to be float has integer division? Integer division doesn't given you float "results".
With integer division the "decimal" part is truncated. So you might have to cast one of the operand of the integer division as float
to get what you want. Of course, you will get your answer as "float" with decimal places and ZEROs without casting. But that would
not be the right answer.

What you don't NEED.
Throw out the header
 #include <stdlib.h>
because you don't need it here and it will make your file unnecessarily large.
Why is that? I will allow you to search that out.
My point, use only what you need.

Lastly, format your code properly using spacing. It makes your code easy to read.

Of course, I could have just corrected your code and repost. But I would not have helped you and but now that you have
to make the changes yourself. When you get it I would not have robbed you of the joy of accomplishment.

Hope this helps.


Thanks alot, the program is now ok.
Programming / Help With C by rawplantain: 3:20am On Nov 12, 2016
//Below is a simple code, but it,s not working fine, guess there is a logical error but i can,t figure it out
#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause"wink or input loop */

int main(int argc, char *argv[]) {
int i;
int n;
int sum =0;
printf("Enter the number of students\n"wink;
scanf("%d\n", &n);
int a[n];
for (i=0;i<n;i++){
printf("Enter the score for student %d\n", i);
scanf("%d\n", &a[i]);
sum=sum+a[i];

}

printf("The sum is %d\n", sum);
float avg;
avg=sum/n;
printf("The average is %f\n", avg);

return 0;
}
// Thanks
Politics / Re: Nassarawa Lawmakers In Free For All Fight by rawplantain: 6:58am On Apr 05, 2016
Many are mad,few are roaming
Science/Technology / Re: Python Killed In An Oil Company In Delta State Today by rawplantain: 8:48pm On Mar 17, 2016
Since December 20 2015
Programming / Re: I Want To Hire A Beginner Who Is Willing To Learn New Skills by rawplantain: 12:10pm On Mar 14, 2016
Am interested in learning new skills...I can use C/Linux and visual basic 6...My mail is greatdamola@yahoo.com...Thanks

1 Like

Family / Re: How To Boost Your Family's Brain Power by rawplantain: 6:35pm On Jan 16, 2016
How much and how can I get it?
Politics / Re: Fayose Distributing Bags Of Rice To People In Ekiti. Photos by rawplantain: 10:42am On Dec 24, 2015
TonyeBarcanista:
I have been witholding my position on Fayose's style of 'governance' all these whÍle. I think it's time to express it.


With due respect to Governor Ayo Fayose and his supporters, I think the Governor is abusing governance and is damaging the psyche of average Ekiti indigene on the responsibility of government by his actions.

His stomach infrastructure program has made government to be a "come and chop" affair. Instead of devoting such resources towards capacity building that will boost the human development of Ekiti people, and also wealth creation programs that will empower Ekiti people to be able to increase their financial capacity and build Ekiti economy, the governor rather spend it on non productive stomach infrastructure.

This pattern of sharing rice, cutting animal skin(kpomo), buying seasoning etc doesn't help the state go grow. Has he asked himself, "after eating the rice, what next for the people?" Will he feed them three times in a day? Will he give them money to buy cloths? Will he give them Shelter? Will he 'dash' the people automobile? How can his people get these without real empowerment?


I pray the Governor doesn't carry this form of governance(misgovernance) into the new year! He may not be the worst Governor but he needs to change...
Chai dey don hack Barcanista account... Dis cannot be his comment...
Adverts / Re: Transfer Money Abroad Without Stress And With Best Charge by rawplantain: 4:13pm On Dec 23, 2015
Please send to greatdamola@yahoo.com
Politics / Re: Troops Engage In Clearance Operation,Destroy More Boko Haram Camps In Borno(pics by rawplantain: 8:00pm On Nov 23, 2015
Picture 1 and 2 are too neat to be true... Photoshop tinx.. How pot go hang for air??
Politics / Re: Troops Engage In Clearance Operation,Destroy More Boko Haram Camps In Borno(pics by rawplantain: 7:55pm On Nov 23, 2015
INTROVERT:
Nice work.....





















kill em all
U dey on break before??.. Hope you enjoyed your vacation
Jobs/Vacancies / Re: Oando Graduate Trainee Recruitment 2014 by rawplantain: 8:42am On Nov 21, 2015
Jobs/Vacancies / Re: Oando Graduate Trainee Recruitment 2014 by rawplantain: 8:04am On Nov 19, 2015
Hi.. Am preparing for oando internship and a friend just told me the questions are essentially shl... Anyone with a link on where to download past questions... Thanks
Music/Radio / Re: Top 20 Songs You Must Have On Your Playlist by rawplantain: 5:21pm On Nov 05, 2015
Where is Ayinla omoruwa, ebenezer obey, sunny ade, barrister, Kwam 1,Don Williams, Kenny Rogers, R Kelly, Akon... Op u are a joker..
Nairaland / General / Re: FUNAAB Mano'war Recruitment Camp 25th Of July (Photos) by rawplantain: 5:12am On Oct 28, 2015
dihalao:
Do you get paid when you join Man'O War or you do it for free?
My type of girl... U are thinking straight
Celebrities / Re: Julius Agwu And Kids On Their Way To Church This Morning (photo) by rawplantain: 11:26am On Oct 25, 2015
How is this a news? Mods stop taking wet weed

2 Likes

(1) (of 1 pages)

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 21
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.