![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Enterprise Unix Roundup: The Ghost of Unix Future - Server Watch | iBot | UNIX and Linux RSS News | 0 | 12-19-2007 12:20 PM |
| Running UNIX commands remotely in Windows box from Unix box – avoid entering password | D.kalpana | UNIX for Dummies Questions & Answers | 1 | 04-20-2007 05:24 AM |
| FTP script for sending a file from one unix directory to another unix server director | raja_1234 | Shell Programming and Scripting | 1 | 11-30-2006 07:57 AM |
| Unix History Question: Why are filenames/dirnames case sentsitive in Unix? | deckard | UNIX for Dummies Questions & Answers | 3 | 03-26-2005 01:59 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Code:
BEGIN{ print "Name Test1 Test2 Test3 Average Grade"}
{avg=($2+$3+$4)/3;
avgtest2+=$3
avgtest3+=$4
if (avg >= 90) grade="A"
else if (avg < 90 && avg >= 80) grade="B"
else if (avg < 80 && avg >= 70) grade="C"
else if (avg < 70 && avg >= 60) grade="D"
else if (avg < 60 && avg >= 50) grade="E"
else grade="F"
printf("%-8s%-8d%-8d%-8d%-8d%-8s\n",$1,$2,$3,$4,avg,grade)}
END{
printf "Average%-8d%-8d%-8d\n",avgtest1/NR,avgtest2/NR,avgtest3/NR}
Code:
Name Test1 Test2 Test3 Average Grade Peter 90 80 70 80 B Alive 79 89 69 79 C David 99 79 89 89 B Average0 82 76 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|