| assignment palat c prog. | |
|
|
Author | Message |
---|
JaVS_v2.5 Admin
Number of posts : 155 Age : 33 Localisation : vision homes seremban 2 Registration date : 2007-06-26
| Subject: assignment palat c prog. Sun Aug 22, 2010 2:52 am | |
| - Code:
-
submit b4:5pm, 2/9/2010, (hard copy)
q1: write a program that reads a positive integer(n) and then computer and prints the sum of all integers betweek 1 and n.
q2: write a program that reads positive floting point numbers using repetition control-structure untill the user terminates the program by entering zero. your program should determine and print the smallest and largest of the supplied numbers. please include appropriate input validation in your program.
q3: write a program that reads the exam marks for ten student and print the number of passes and failures (mark more then 40 is pass). display also the avarage, highest and lowest exam marks.
_________________________________________ Q1: _________________________________________
#include <stdio.h> void main(void) { int counter=0,calc,sum=0; do{printf("Enter an integer: "); scanf("%d",&calc); if(calc < 0) printf("Invalid input!\n");}while(calc < 0); while(counter <= calc) { sum=sum+counter; counter++; } printf("The sum is: %d\n\n",sum); }
_________________________________________ Q2: _________________________________________
#include <stdio.h> int main(void) { float largest,smallest,input;
do{printf("Insert float [Enter value='0' to quit]: "); scanf("%f",&input); largest = input; smallest = input; if(input < 0) printf("Invalid input!\n"); if(input == 0) break; }while(input < 0);
while(input != 0) { do{printf("Insert float [Enter value='0' to quit]: "); scanf("%f",&input); if(input < 0) printf("Invalid input!\n"); }while(input < 0); if ( input > largest ) { largest = input; } if (input < smallest && input != 0) { smallest = input; } } printf("\nThe largest float you entered is: %.2f\n\n",largest); printf("The smallest float you entered is: %.2f\n\n",smallest);
return 0; }
_________________________________________ Q3: _________________________________________
#include <stdio.h>
int main(void) { int counter=1,sumcounter=0,input,fail=0,pass=0,average,sum=0; int highest,lowest; printf("==============================\n"); for(;sumcounter<1;) for(;counter<2;counter++) { do{printf("Enter student's [%02d] mark: ",counter); scanf("%d",&input); if(input < 0) printf("Invalid input! Value can't be Negative.\n"); else if(input > 100) printf("Invalid input! Value can't Greater than 100.\n"); }while(input < 0 || input > 100); highest=input; lowest=input; sum = sum + input; sumcounter++; if(input <= 40 && input >= 0) input=fail++; else if(input > 40 || input <= 100) input=pass++; } for(;sumcounter<10;) for(;counter<11;counter++) { do{printf("Enter student's [%02d] mark: ",counter); scanf("%d",&input); if(input < 0) printf("Invalid input! Value can't be Negative.\n"); else if(input > 100) printf("Invalid input! Value can't be Greater than 100.\n"); }while(input < 0 || input > 100); if(input > highest) {highest=input;} if(input < lowest) {lowest=input;} sum = sum + input; sumcounter++; if(input <= 40 && input >= 0) input=fail++; else if(input > 40 || input <= 100) input=pass++; } printf("==============================\n"); printf("\t %02d student(s) Passed.\n\t %02d student(s) Failed.\n",pass,fail); average = sum / 10; printf("\t Average mark is: %d\n",average); printf("\t Highest mark is: %d\n",highest); printf("\t Lowest mark is: %d\n",lowest); printf("==============================\n\n");
return 0; }
Assignment palat dah siap!!!woohoo cumshot hahaha | |
|
| |
nazirulez Recruit
Number of posts : 20 Localisation : 6th Hell Registration date : 2007-09-25
| Subject: Re: assignment palat c prog. Mon Aug 23, 2010 4:13 pm | |
| wat da fukin hell iz dat?? | |
|
| |
JaVS_v2.5 Admin
Number of posts : 155 Age : 33 Localisation : vision homes seremban 2 Registration date : 2007-06-26
| Subject: Re: assignment palat c prog. Tue Aug 24, 2010 2:39 am | |
| assignment aku yg palat hahaha. da siap aku taruk kat forum ni wat backup | |
|
| |
smoke_weat BORON!!
Number of posts : 183 Age : 32 Localisation : rising suns Registration date : 2007-08-16
| Subject: Re: assignment palat c prog. Wed Aug 25, 2010 3:00 pm | |
| | |
|
| |
smoke_weat BORON!!
Number of posts : 183 Age : 32 Localisation : rising suns Registration date : 2007-08-16
| Subject: Re: assignment palat c prog. Wed Aug 25, 2010 3:01 pm | |
| assingment palat ke crunk?? LOL!!! | |
|
| |
JaVS_v2.5 Admin
Number of posts : 155 Age : 33 Localisation : vision homes seremban 2 Registration date : 2007-06-26
| Subject: Re: assignment palat c prog. Wed Aug 25, 2010 5:24 pm | |
| - Quote :
- assingment palat ke crunk?? drunken LOL!!! lol!
crunky tamil club | |
|
| |
smoke_weat BORON!!
Number of posts : 183 Age : 32 Localisation : rising suns Registration date : 2007-08-16
| Subject: Re: assignment palat c prog. Thu Aug 26, 2010 2:07 am | |
| | |
|
| |
JaVS_v2.5 Admin
Number of posts : 155 Age : 33 Localisation : vision homes seremban 2 Registration date : 2007-06-26
| Subject: Re: assignment palat c prog. Fri Aug 27, 2010 1:26 pm | |
| ...antara club yg established by mr fuck | |
|
| |
smoke_weat BORON!!
Number of posts : 183 Age : 32 Localisation : rising suns Registration date : 2007-08-16
| Subject: Re: assignment palat c prog. Fri Aug 27, 2010 11:35 pm | |
| hahahahaha!!!betul tuh..tau takpe.. | |
|
| |
smoke_weat BORON!!
Number of posts : 183 Age : 32 Localisation : rising suns Registration date : 2007-08-16
| Subject: Re: assignment palat c prog. Tue Feb 28, 2012 4:31 pm | |
| aku skang pun kene wat coding gak!! eshol tul, aku blaja C# programming. babi!!! | |
|
| |
JaVS_v2.5 Admin
Number of posts : 155 Age : 33 Localisation : vision homes seremban 2 Registration date : 2007-06-26
| Subject: Re: assignment palat c prog. Thu Mar 01, 2012 1:05 pm | |
| hahaha nice...nnti boley share knowledge dgn aku damnit!! | |
|
| |
smoke_weat BORON!!
Number of posts : 183 Age : 32 Localisation : rising suns Registration date : 2007-08-16
| |
| |
JaVS_v2.5 Admin
Number of posts : 155 Age : 33 Localisation : vision homes seremban 2 Registration date : 2007-06-26
| Subject: Re: assignment palat c prog. Wed Mar 14, 2012 8:00 pm | |
| | |
|
| |
smoke_weat BORON!!
Number of posts : 183 Age : 32 Localisation : rising suns Registration date : 2007-08-16
| Subject: Re: assignment palat c prog. Sat Mar 17, 2012 2:32 am | |
| | |
|
| |
Sponsored content
| Subject: Re: assignment palat c prog. | |
| |
|
| |
| assignment palat c prog. | |
|