0% found this document useful (0 votes)
18 views32 pages

Repetition 16 Questions and Answerss Pi

The document contains multiple C code programs that calculate totals, averages, and other values from user input data related to pizza orders, item purchases, exam scores, and more. Each program uses loops and conditional statements to repeatedly accept numeric input, perform calculations, and output results.

Uploaded by

jscricinfo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views32 pages

Repetition 16 Questions and Answerss Pi

The document contains multiple C code programs that calculate totals, averages, and other values from user input data related to pizza orders, item purchases, exam scores, and more. Each program uses loops and conditional statements to repeatedly accept numeric input, perform calculations, and output results.

Uploaded by

jscricinfo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

#include<stdio.

h>

int main(void){

int type,quantity;

float discount,price,total=0;

printf("Enter Pizza Type:");

scanf("%d",&type);

while(type!=-1){
total=0;

printf("Enter Quantity:");

scanf("%d",&quantity);

if(type==1){

price=1000.00;

discount=10;

else if(type==2){

price=1600.00;

discount=12;

else if(type==3){

price=1400.00;

discount=15;

if(quantity>3){

total=quantity*price;

total=total-(total*(discount/100));

else{

total=quantity*price;

printf("Total price Rs :%.2f\n\n",total);

printf("Enter Pizza Type:");


scanf("%d",&type);

return 0;

#include<stdio.h>
int main(void){

int item,quantity;

float total=0,price;

printf("Enter item:");

scanf("%d",&item);

while(item!=-99){

printf("Enter Quantity:");

scanf("%d",&quantity);

if(item==1){

price=30.00;}

else if(item==2)

price=45.00;

else if(item==3){

price=55.50;}

else{

printf("Invalid Item Number\n");

total=total+(price*quantity);

printf("\n");

printf("Enter item:");
scanf("%d",&item);

printf("\nTotal Pricee to pay Rs :%.2f",total);

return 0;}

#include<stdio.h>

int main(void){

int item,quantity;

float Uprice,total=0;

printf("\nEnter Item:");
scanf("%d",&item);

while(item!=-1){

printf("Enter Quantity:");

scanf("%d",&quantity);

if(item==1)

Uprice=300.25;

else if(item==2)

Uprice=145.50;

else if(item==3)

Uprice=525.00;

else{

printf("Invalid Item Number\n");

total=total+(quantity*Uprice);

printf("\nEnter Item:");

scanf("%d",&item);}

printf("Total Price To pay Rs:%.2f",total);

return 0;

}
#include<stdio.h>

int main(void){

int Btype,quantity;

float Total,Extra;
printf("Enter The Buger type:");

scanf("%d",&Btype);

while(Btype>0 && Btype<4){

Total=0;

printf("Enter Quantity:");

scanf("%d",&quantity);

if(Btype==1)

Extra=0;

else if(Btype==2)

Extra=50.00;

else if(Btype==3)

Extra=100.00;

Total=(500.00+Extra)*quantity;

printf("Total Price Rs:%.2f\n\n",Total);

printf("Enter The Buger type:");

scanf("%d",&Btype);

return 0;

}
#include<stdio.h>

int main(void){

int players,round,count,score,total=0;

printf("How many players are in the race:");

scanf("%d",&players);

for(count=1;count<=players;count++){

total=0;

printf("\nEnter the scores of player %d(between 0-5)\n",count);

for(round=1;round<=4;round++){

printf("round %d-",round);

scanf("%d",&score);

if(score>0 && score<6){

total=total+score;

else{

printf("Enter again Invalid input\n");

round--;

printf("average score-%.1f\n",total/4.0);}

return 0;

}
#include<stdio.h>

int main(void){

int students,Mcount,count,marks,total;

printf("How many Students are in the Module:");

scanf("%d",&students);

for(count=1;count<=students;count++){
total=0;

printf("\nEnter the marks of student %d(between 0-10)\n",count);

for(Mcount=1;Mcount<=3;Mcount++){

printf("mark %d-",Mcount);

scanf("%d",&marks);

if(marks>=0 && marks<11)

total=total+marks;

else{

printf("Enter again Invalid Marks\n");

Mcount--;

printf("Total marks-%d\n",total);

}
#include<stdio.h>

int main(void){

char player;

int Pcount=0,round,score,total;

do{
Pcount++;

total=0;

printf("Enter the scores of player %d(between 0-4)\n",Pcount);

for(round=1;round<=3;round++){

printf("round %d-",round);

scanf("%d",&score);

if(0<=score && 5>score)

total=total+score;

else{

round--;

printf("Invalid Score.. Enter again\n");

printf("average score-%.2f\n",total/3.0);

printf("Do you want to enter the scores of another player(y/n)?");

scanf(" %c",&player);

}while(player=='y' || player=='Y');

return 0;

}
#include<stdio.h>

int main(void){

int players,round,count,score,total;

printf("How many players are in the race:");


scanf("%d",&players);

for(count=1;count<=players;count++){

total=0;

printf("\nEnter the scores of player %d(between 0-7)\n",count);

for(round=1;round<=2;round++){

printf("round %d-",round);

scanf("%d",&score);

if(0<=score && score<8)

total=total+score;

else{

round--;

printf("Invalid score...Enter again\n");

printf("average score-%.1f\n",total/2.0);

}
#include<stdio.h>

int main(void)

int Mcount,Scount=0,marks,total;

char student;

do{

Scount++;

total=0;

printf("\nEnter the marks of Student %d(between 0-10)\n",Scount);

for(Mcount=1;Mcount<=3;Mcount++){

printf("Mark %d-",Mcount);

scanf("%d",&marks);

if(0<=marks && marks<11)


total+=marks;

else{

Mcount--;

printf("Invalid Marks..Enter again\n");

printf("\ntotal=%d",total);

printf("\nDo you want to enter marks of another student(y/n)?");

scanf(" %c",&student);

}while(student=='y' || student=='Y');

return 0;

}
#include<stdio.h>

int main(void)

int Mcount,Scount=0,marks,total;

char student;

do{

Scount++;

total=0;

printf("\nEnter the marks of Student %d(between 0-20)\n",Scount);

for(Mcount=1;Mcount<=4;Mcount++){

printf("Mark %d-",Mcount);

scanf("%d",&marks);

if(0<=marks && marks<21)

total+=marks;

else{

Mcount--;

printf("Invalid Marks..Enter again\n");

printf("\ntotal=%d",total);

printf("\nDo you want to enter marks of another student(y/n)?");

scanf(" %c",&student);
}while(student=='y' || student=='Y');

return 0;

}
#include<stdio.h>

int main(void){

int number,range,count;

printf("Enter The Number:");

scanf("%d",&number);

printf("Enter the range:");

scanf("%d",&range);

for(count=1;count<=range;count++){

printf("%d x %d=%d\n",number,count,number*count);

return 0;

}
#include<stdio.h>

int main(void){

int players,score,total=0,count,Pnumber,win,max=0;

printf("Input number of players:");

scanf("%d",&players);

for(players;0<players;players--){

total=0;

printf("\nInput Player number:");


scanf("%d",&Pnumber);

for(count=1;count<=3;count++){

printf("Input Score %d:",count);

scanf("%d",&score);

total=total+score;

printf("Total Score:%d",total);

if(total>=max){

max=total;

win=Pnumber;

printf("\nThe Winner is Player Number:%d",Pnumber);

return 0;

}
#include<stdio.h>

int main(void){

int count,marks,total=0;

float average;

for(count=1;count<=5;count++){

printf("Input the mark number %d:",count);

scanf("%d",&marks);
if(marks>=0 && marks<=100)

total=total+marks;

else{

printf("Invalid Input!!\n");

count--;

printf("\nAverage of the 5 marks is :%.2f",total/5.0);

return 0;

}
#include<stdio.h>

int main(void){

char player;

int Pcount=0,round,score,total;

do{

Pcount++;

total=0;

printf("Enter the scores of player %d(between 0-8)\n",Pcount);

for(round=1;round<=5;round++){

printf("round %d-",round);

scanf("%d",&score);

if(0<=score && 8>score)


total=total+score;

else{

round--;

printf("Invalid Score.. Enter again\n");

printf("average score-%.2f\n",total/5.0);

printf("Do you want to enter the scores of another player(y/n)?");

scanf(" %c",&player);

}while(player=='y' || player=='Y');

return 0;

}
#include<stdio.h>

int main(void){

char player;

int Pcount=0,round,score,total;

do{

Pcount++;

total=0;

printf("Enter the scores of player %d(between 0-4)\n",Pcount);

for(round=1;round<=3;round++){

printf("round %d-",round);

scanf("%d",&score);
if(0<=score && 5>score)

total=total+score;

else{

round--;

printf("Invalid Score.. Enter again\n");

printf("average score-%.2f\n",total/3.0);

printf("Do you want to enter the scores of another player(y/n)?");

scanf(" %c",&player);

}while(player=='y' || player=='Y');

return 0;

}
#include<stdio.h>

int main(void){

int number,count;

do{

printf("Enter Number:");

scanf("%d",&number);

if(number>0)

break;

printf("Invalid Number\n");

}while(1);
for(count=1;count<=10;count++){

printf("%d x %d=%d\n",number,count,number*count);

You might also like