www.vustudents.ning.com

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

# Assignment # 1 CS201

I have done the assignment almost but the problem is that in assignment average value is 23 but according my program it's avg is 22 because 22.4 is the average if we calculate on the calculator so 0.4 will be truncated and the answer will be 22. My answer is as follows in attachment........................

Second problem is that instead of 1st,2nd,3rd....my answer is like this 1 ,2,3 .....

If you have better  idea please share and you can also add me on my skype id

shahid.khalil123

Views: 2050

Attachments:

### Replies to This Discussion

actually when average is calculated its value is float but when u assign to int variable it lost the decimal fraction so need to cast value in double and use math library function as

int average=ceil(double(sum/limit)); this statement out 23

i hope u get 23 now :P

I  got the point but its not working yet. It's giving the same result.

u r right . but round off 22.4 must b 22 not 23 , that is a big mistake.

have you done the assignment???

bro average key liay variable float use karo

can someone kindly tell me...whenever i run my program the output window is disappear

Assalam o Alaikum!

for printing 1st, 2nd, 3rd,4th you need to use if-else if statements, first you need to write

if main                     i "st"

else if main               i"nd"

else if main                  i"rd"

sirf else                    i"th"

kyun kie baqi sab main th hi use hoga

Dear Fellows,

All of you are requested, Please post Only One Discussion for Current Assignment/GDB/Online Quiz and everyone reply/share/discussed his/her data on that same discussion, so that all members get solution & discuss easily on Current Assignment/GDB/Online Quiz.

So please don’t post two or more discussions for one Current Assignment/GDB/Online Quiz, hope you’ll understand and cooperate with us.

http://vustudents.ning.com/group/cs201introductiontoprogramming/for...

thanks for understanding

Salam Guys check my assignment and tell me if there is any problem..its attached below...

Attachments:

current

1

2

3

4

5

## VIP Member Badge & Others

------------------------------------

## Latest Activity

Fatima replied to Fatima's discussion eco403 assignment solution 2 in the group ECO403 Macroeconomics
24 minutes ago
vu student updated their profile
25 minutes ago

### Jannah ? Hold you deen tight.

56 minutes ago
2 hours ago
3 hours ago
Muhammad Bilal replied to BBA(6th smes)'s discussion assignment 1 spring 2021 in the group MGT402 Cost & Management Accounting
4 hours ago
★---★ ⱮԱϚҠȺហ ȺచȺហ ★---★ updated their profile
4 hours ago
Mani Siddiqui posted a discussion

5 hours ago