0% found this document useful (0 votes)
198 views

10th Class Chapter 3

b

Uploaded by

k53255706
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
198 views

10th Class Chapter 3

b

Uploaded by

k53255706
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

COMPUTER SCIENCE FOR CLASS 10

Short Questions
UNIT # 3
Conditional Logic

Q1: What is conditional logic?


Ans: All the decisions are taken on the basis of condition. If the condition is true, we perform
the specified task, otherwise we do not. Sometimes if the condition is not true then we
perform some other task. This is called conditional logic.
Q2: What is block or compound statement?
Ans: A set of multiple instructions enclosed in braces is called a block or a compound
statement.
Q3: Draw a flowchart to show the Start
structure of “if” statement.
Ans:
False Condition True

Associated Code

End

Start
Q4: Draw a flowchart to show the
structure of “if else” statement.
Ans: False Condition True

Associated Code with Associated Code with


ELSE statement IF statement

End

Q5: How to write associated code in selection statement if it contains one or more
statements?
Ans: If we want to associate more than one statements to an if statement, then they need to
be enclosed inside a { } block, but if we want to associate only one statement, then
although it may be enclosed inside { } block, but it is not mandatory.
Created By: Bilal Ahmad 1
Q6: Write a program in C language that takes the percentage of student as an input
and displays “PASS” if the percentage is above 50.
Ans: #include <stdio.h>
void main()
{
float percentage;
printf(“Enter the percentage: ”);
scanf(“%f”, &percentage);
if( percentage > 50 )
printf(“PASS \n ”);
}
Q7: Which thing improves the readability of the program.
Ans: Properly indent the instructions under if statement using tab. It improves the readability of
the program.
Q8: What is block or compound statement?
Ans: A set of multiple instructions enclosed in braces is called a block or a compound
statement.
Q9: Write a program that takes a character as input and displays “DIGIT” if the
character entered by user is a digit between 0 to 9, otherwise displays “NOT
DIGIT”.
Ans: #include <stdio.h>
void main()
{
char input ;
printf(“Please enter a character:”);
scanf(“%c”, &input);
if( input >= ‘0’ && input <= ‘9’ )
printf(“DIGIT \n”);
else
printf(“NOT DIGIT \n”)

Q10: Write the syntax of if-else-if statement.


Ans: C language also provides an if-else-if statement that has the following structure.

If (condition 1)
Code to execute if condition 1 is true;
else if (condition 2)
Code to execute if condition 1 is false but condition 2 is true;
.
.
.
else if (condition N)
Code to execute if all previous conditions are false but condition N is true;
else
Code to execute if all conditions are false;

Created By: Bilal Ahmad 2


Q11: Write a program that takes percentage marks of student as input and displays his
grade according to following distribution criteria.

Percentage Grade
80% and above A
70% - 80% B
60% - 70% C
50% - 60% D
Below 50% F

Ans: #include <stdio.h>


void main()
{
float percentage;
printf (“Please enter percentage: ”);
scanf (“%f”, &percentage);
if ( percentage >= 80)
printf(“A\n”);
else if ( percentage >= 70 )
printf(“B\n”);
else if ( percentage >= 60 )
printf(“C\n”);
else if ( percentage >= 50 )
printf(“D\n”);
else
printf(“F\n”);
}

Created By: Bilal Ahmad 3


COMPUTER SCIENCE FOR CLASS 10
Exercise Questions
UNIT # 3
Conditional Logic

Q1: Multiple Choice Questions


1. Conditional logic helps in_____________.
a) Decisions b) Iterations c) Traversing d) All
2. _______statements describe the sequence in which statements of the program
should be executed.
a) Loop b) Conditional logic c) Control d) All
3. In if statement, what happens if condition is false?
a) Program crashes b) Index out of bound error
c) Further code executes d) Compiler asks to change condition
4. int a = 5;
If ( a < 10 )
a++;
else
if ( a > 4 )
a--;
Which of the following statements will execute?
a) a++ b) a - - c) both (a) and (b) d) none
5. Which of the following is the condition to check a is a factor of c?
a) a % c = = 0 b) c % a = = 0 c) a * c = = 0 d) a + c = = 0
6. A condition can be any _____________ expression.
a) arithmetic b) relational c) logical d) All
7. An if statement inside another if statement is called _________structure.
a) Nested b) boxed c) Repeated d) Decomposed
8. A set of multiple instructions enclosed in braces is called a __________.
a) Box b) List c) Block d) Job

Q2: Define the following.


1. Control statements
Ans: Sometimes we need to execute one set of instructions if a particular condition is true and
another set of instructions if the condition is false.
Sometimes we need to repeat set of statements for a number of times. We can control
the flow of program execution through control statements.
There are three types of control statements in C language.
Created By: Bilal Ahmad 4
 Selection Control Statements
 Sequential Control Statements
 Repetition Control Statements
2. Selection Statements
Ans: The statement which help us to decide which statements should be executed next, on
the basis of conditions, are called selection statements.
Two types of selection statements are:
1. If statement
2. If – else statement
3. Sequential Control
Ans: Sequential control is the default control structure in C language. According to the
sequential control, all the statements are executed in the given sequence.
4. Condition
Ans: A condition could be any valid expression including arithmetic expressions. Relational
expression, logical expressions or a combination of these. Here are few examples of
valid expressions that can be used as condition.
a. 5 (true)
b. 5-5 (false)
c. !(4>5) (true)
d. ( 5 > 4 ) || ( 9 < 10 ) (true)
5. Nested Selection Structures
Ans: Inside an if block or inside an else block, we can have other if statements or if-else
statements. It also means that inside those inner if statements or if- else statements we
can have even more if statements or if- else statements and so on.
if (condition1 is true)
if (condition2 is true)
Associated code
else
Associated code
else
if (condition3 is true)
Associated code
else
Associated code

Q3: Briefly answer the following questions.


1. Why do we need selection statements?
Ans: The statement which help us to decide which statements should be executed next, on
the basis of conditions, are called selection statements.
Two types of selection statements are:
3. If statement
4. If – else statement

Created By: Bilal Ahmad 5


2. Differentiate between sequential and selection statements.
Ans:
Sequential Statement Selection Statement
Sequential control is the default control The statement which help us to decide which
structure in C language. According to the statements should be executed next, on the
sequential control, all the statements are basis of conditions, are called selection
executed in the given sequence. statements.

3. Differentiate between if statement and if else statement with an example.


Ans:
If Statement If - else Statement
The code gets executed if the specified The else code gets executed if the specified
condition turns out to be true. condition turns out to be false.
Associated code is specify only with if Associated codes are specified with if as well
statement as with else statement
Syntax: if(condition) Syntax: if(condition)
Associated Code Associated Code
else
Associated Code

4. What is the use of nested selection structures?


Ans: Inside an if block or inside an else block, we can have other if statements or if-else
statements. It also means that inside those inner if statements or if- else statements we
can have even more if statements or if- else statements and so on.
if (condition1 is true)
if (condition2 is true)
Associated code
else
Associated code
else
if (condition3 is true)
Associated code
else
Associated code

5. Write the structure of if statement with brief description.


Ans: C language provides if statement in which we specify a condition, and associate a code
to it. The code gets executed if the specified condition turns out to be true, otherwise the
code does not get executed.

Structure of if statement:
If statement has the following structure in C language

if(condition)
Associated Code

Here is a brief description of different components involved in the general structure of if


statement.

1. In the given structure, if is a keyword that is followed by a condition inside


parentheses ().

Created By: Bilal Ahmad 6


2. A condition could be any valid expression including arithmetic expressions.
Relational expression, logical expressions or a combination of these. Here are few
examples of valid expressions that can be used as condition.
a. 5 (true)
b. 5-5 (false)
c. !(4>5) (true)
d. ( 5 > 4 ) || ( 9 < 10 ) (true)

Q4: Identify errors in the following code segments. Assume that variables have already
been declared.
a) if ( x ≥ 10 )
printf ( “ Good ” ) ;

Ans: Invalid greater than and equal sign

b) if ( a < b && b < c ) ;


sum = a + b + c;
else
multiply = a * b * c ;
Ans:
Semicolon ; cannot be used with if statement

c) if ( a < 7 < b )
printf ( “ 7 ” ) ;

Ans: If statement must be written as if( a < 7 && b > 7 )

d) if ( a == b & | x == y )
flag = true ;
else
flag = false ;
Ans:
Invalid syntax of AND and OR operator &|

e) if ( sum == 60 || product == 175 )


printf ( “Accepted %c ) , sum ) ;
else
if ( sum >= 45 || product > 100 )
printf ( “ Considered %c) + sum ) ;
else
printf ( “ Rejected ” ) ;
Ans: Double quotes are missing at printf (“Considered % c) + sum);
and there should be %d instead of %c

Created By: Bilal Ahmad 7


Q5: Write down output of the following code segments.

a) int a = 7, b = 10;
a=a+b;
if( a > 20 && b < 20 )
b=a+b
printf( “ a = % d , b = %d ” , a , b ) ;

Ans:
a = 17 , b = 10

b) int x = 45 ;
if( x + 20 * 7 == 455 )
printf( “ Look’s Good ” ) ;
else
printf(“ Hope for the Best ” ) ;
Ans:
Hope for the best

c) char c1= ‘Y’ , c2 = ‘N’ ;


int n1=5 , n2=9;
n1=n1+1;
c1=c2;
if ( n1==n2 && c1==c2)
printf(“%d=%d and %c =%c” ,n1,n2,c1,c1);
else
if (n1<n2 && c1 ==c2)
printf(“%d<%d and %c =%c” ,n1,n2,c1,c1);
else
printf(“Better Luck Next Time!”);
Ans:
6 < 9 and N = N

d) int a =34,b=34,c=7,d=15;
a=b+c+d;
if (a<100)
a=a*2
b=b*c;
c=c+d;
if (a>b && c==d)
{ c=d;
b=c;
a=b;
}
else
if (a>b && c>d || b >=d+c)
{ d=c*c;
a=b*b;
}
printf(“a=%d,b=%d,c=%d,d=%d”,a,b,c,d);
Created By: Bilal Ahmad 8
Ans:
a=50176,b=224,c=22,d=484

e) int x= 5,y=7,z=9;
if (x%2==0)
x++;
else
x=y +z;
printf(“x=%d\n”,x);
if ( x%2==1 && y%2==1 && z%2==1 )
printf(“All are Odd”);
if (x>y || x<z)
{
if( x>y )
y++;
else
if (x<z)
x++;
}
printf(“x=%d,y=%d,z=%d”,x,y,z);

Ans: x=16
x=16, y=8, z=9

Created By: Bilal Ahmad 9


Programming Exercises

Exercise 1

Write a program that takes two integers as input and tells whether first one is a
factor of the second one?

Ans: #include<stdio.h>
void main()
{
int n1, n2;
printf("Input the first integer:");
scanf("%d",&n1);
printf("Input the seecond integer:");
scanf("%d",&n2);
if(n2%n1==0)
printf("\n%d is a Factor of %d.\n",n1,n2);
else
printf("\n%d is not a Factor of %d.\n",n1,n2);
}

Exercise 2

Write a program that takes a number as input and displays “YES” if the input
number is a multiple of 3, and has 5 in unit’s place e.g. 15,75.
Ans: #include<stdio.h>
void main()
{
int num;
printf("Enter any Number");
scanf("%d",&num);
if(num%3==0 && num%10==5)
printf("YES");
else
printf("NO");
}

Exercise 3

Following is the list of discounts available in “Grocery Mart”.

Total Bill Discount


1000 10
2500 20
5000 35
10000 50

Created By: Bilal Ahmad 10


Write a program that takes total bill as input and tells how much discount the user
has got and what is the discounted price.
Ans: #include<stdio.h>
void main()
{
float bill, dis_per, dis_price, payable_bill;
printf("Please Enter Bill: ");
scanf("%f",&bill);
if(bill>=1000 && bill<2500)
dis_per=10;
else if(bill>=2500 && bill<5000)
dis_per=20;
else if(bill>=5000 && bill<10000)
dis_per=35;
else if(bill>=10000)
dis_per=50;
dis_price=dis_per/100*bill;
payable_bill=bill-dis_price;
printf("You got %.0f%% discount.\n",dis_per);
printf("You got Rs.%.0f discount.\n",dis_price);
printf("Your Bill after discount = %.2f\n", payable_bill);
}

Exercise 4

Write a program that takes as input, the original price and sale price of a product
and tells whether the product is sold on profit or loss. The program should also
tell the profit/loss percentage.
Ans: #include<stdio.h>
void main()
{
float cp, sp, profit, loss, loss_p, profit_p;
printf("Enter Cost price of Product: ");
scanf("%f", &cp);
printf("Enter Sale price of Product: ");
scanf("%f", &sp);
if(cp<sp)
{
printf("You Got profit!\n");
profit=sp-cp;
profit_p=profit/cp*100;
printf("Profit = %.2f\n",profit);
printf("Profit percentage is %.2f\n", profit_p);
}
else if(cp>sp)
{
printf("You got loss!\n");
loss=cp-sp;
loss_p=loss/cp*100;
Created By: Bilal Ahmad 11
printf("Loss = %.2f\n",loss);
printf("Loss percentage is %.2f\n",loss_p);
}
}
Exercise 5

Write a program that takes as input, the lengths of 3 sides of a triangle and tells
whether it is a right angle triangle or not. For a right angled triangle,
Hypotenuse2=base2+height2

Ans: #include<stdio.h>
void main()
{
float b,ht,h;
printf("Enter The Base of Triangle: ");
scanf("%f",&b);
printf("Enter The Height of Triangle: ");
scanf("%f",&ht);
printf("Enter The Hypotenuse of Triangle: ");
scanf("%f",&h);
if( h*h == b*b + ht*ht )
printf("It is Right Angle Triangle");
else
printf("It is Not a Right Angle Triangle");
}
Exercise 6

Following is the eligibility criteria for admission in an IT University.


 At least 60% marks in Matric.
 At least 65% marks in Intermediate (Pre-Engineering or ICS).
 At least 65% marks in entrance test.
Write a program that takes as input, the obtained and total marks of Matric,
Intermediate and Entrance Test. The program should tell whether the student is
eligible or not.
Ans: #include<stdio.h>
void main()
{
int matric, inter, entr;
int t_matric, t_inter, t_entr;
int p_matric, p_inter, p_entr;

printf("Enter Total Marks of Matric: ");


scanf("%d",&t_matric);
printf("Enter Obtained Marks of Matric: ");
scanf("%d",&matric);

printf("\nEnter Total Marks of Intermediate: ");


scanf("%d",&t_inter);
printf("Enter Obtained Marks of Intermediate: ");
scanf("%d",&inter);
Created By: Bilal Ahmad 12
printf("\nEnter Total Marks of Entrance: ");
scanf("%d",&t_entr);
printf("Enter Obtained Marks of Entrance: ");
scanf("%d",&entr);

p_matric=matric/t_matric*100;
p_inter=inter/t_inter*100;
p_entr=entr/t_entr*100;

if(p_matric>=60 && p_inter>=65 && p_entr>=65)


printf("\nStudent is eligible");
else
printf("\nStudent is not eligible!\n");
}
Exercise 7

Write a program that calculates the bonus an employee can get on the following
basis:
Salary Experience Bonus Tasks Bonus
10000 2 Years 5 1500
10000 3 Years 10 2500
25000 3 Years 4 2000
75000 4 Years 7 3500
100000 5 Years 10 5000
The program should take as input, the salary, experience and number of bonus
tasks of the employee. The program should display the bonus on the screen.

Ans: #include<stdio.h>
void main()
{
int salary, exp, task, bonus;
printf("Enter Your Salary: );
scanf("%d",&salary);
printf("Enter Your Experience: ");
scanf("%d",&exp);
printf("Enter Your Number of Bonus tasks: ");
scanf("%d",&task);

if(salary==10000 && exp==2 && task==5)


bonus=1500;
if(salary==10000 && exp==3 && task==10)
bonus=2500;
if(salary==25000 && exp==3 && task==4)
bonus=2000;
if(salary==75000 && exp==4 && task==7)
bonus=3500;
if(salary==100000 && exp==5 && task==10)
bonus=5000;
printf("\nYou got Bonus = %d",bonus);

Created By: Bilal Ahmad 13


COMPUTER SCIENCE FOR CLASS 10
Activities
UNIT # 3
Conditional Logic

Activity 3.1:

Write a program that takes the age of a person as an input and displays
“Teenager” if the age lies between 13 and 19.
Ans: #include<stdio.h>
void main()
{
int age;
printf("Please Enter Your Age: ");
scanf("%d",&age);
if(age>=13 && age<=19)
printf("Teenager");
else
printf("Not a Teenager");
}

Activity 3.2:
Write a program that takes year as input and displays “Leap Year” if the input year
is leap year. Leap years are divisible by 4.
Ans: #include<stdio.h>
void main()
{
int year;
printf("Please Enter Year: ");
scanf("%d",&year);
if(year%4==0)
printf("Leap Year");
else
printf("Not a leap year");
}

Activity 3.3:
Write a program that takes the value of body temperature of a person as an input
and displays “You have fever.” If body temperature is more than 98.6 otherwise
displays “You don’t have fever.”

Created By: Bilal Ahmad 14


Ans: #include<stdio.h>
void main()
{
float temp;
printf("Please Enter Temperature: ");
scanf("%f",&temp);
if(temp>98.6)
printf("You have fever.");
else
printf("You don't have fever.");
}

Activity 3.4:
The eligibility criteria of a university for its different undergraduate programs is as
follows:
BSSE Program: 80% or more marks in Intermediate
BSCS Program: 70% or more marks in Intermediate
BSIT Program: 60% or more marks in Intermediate

Otherwise the university do not enroll a student in any of its programs. Write a
program that takes the percentage of Intermediate marks and tells for which
programs the student is eligible to apply.
Ans: #include<stdio.h>
void main()
{
float percent;
char a;
ag:
printf("Please Enter the Percentage of Intermediate Marks: ");
scanf("%f",&percent);
if(percent>=80)
printf("You are Eligible for BSSE, BSCS and BSIT\n");
else if(percent>=70)
printf("You are Eligible for BSCS and BSIT\n");
else if(percent>=60)
printf("You are Eligible for BSIT only\n");
else
printf("You are Not Eligible\n");
}
Activity 3.5:
Write a program that takes two integers as input and asks the user to enter a
choice from 1 to 4. The program should perform the operation according to the
given table and display the result.

Choice Operation
1 Addition
2 Subtraction
3 Multiplication
4 Division

Created By: Bilal Ahmad 15


Ans: #include<stdio.h>
void main()
{
int a, b, choice;
printf("Enter 1st integer: ");
scanf("%d",&a);
printf("Enter 2nd integer: ");
scanf("%d",&b);
printf("Enter choice from given below:\n");
printf("1:Addition\n2:Subtraction\n3:Multiplication\n4:Division\n");
scanf("%d", &choice);

if(choice==1)
printf("Addition is %d", a+b);
else if(choice==2)
printf("Subtraction is %d", a-b);
else if(choice==3)
printf("Multiplication is %d", a*b);
else if(choice==4)
printf("Division is %d", a/b);
}
Activity 3.6:
Write a program that finds and displays area of a triangle, parallelogram, rhombus
or trapezium according to the choice of user.
Ans: #include<stdio.h>
void main()
{
float length, width, height, b1, b2, area;
int choice;
printf("Select option of calculate area: \n");
printf("1:Triangle: \n2:Parallelogram: \n3:Rhombus: \n4:Trapezium: \n");
scanf("%d",&choice);
if(choice==1)
{
printf("Enter length of triangle: \n");
scanf("%f", &length);
printf("Enter width of triangle: \n");
scanf("%f", &width);
area=0.5*length*width;
printf("Area of triangle = %.2f\n",area);
}
else if(choice==2)
{
printf("Enter length of parallelogram: \n");
scanf("%f", &length);
printf("Enter width of parallelogram: \n");
scanf("%f", &width);
area=length*width;
printf("Area of parallelogram = %.2f\n",area);
}
else if(choice==3)
{
printf("Enter 1st diagnal of rhombus: \n");

Created By: Bilal Ahmad 16


scanf("%f", &length);
printf("Enter 2nd diagnal of rhombus: \n");
scanf("%f", &width);
area=0.5*length*width;
printf("Area of rhombus = %.2f\n",area);
}
else if(choice==4)
{
printf("Enter 1st Base of trapezium: \n");
scanf("%f", &b1);
printf("Enter 2nd Base of trapezium: \n");
scanf("%f", &b2);
printf("Enter height of trapezium: \n");
scanf("%f", &height);
area=0.5*height*(b1+b2);
printf("Area of trapezium = %.2f\n",area);
}
else
printf("Please enter valid choice!\n\n");
}

Created By: Bilal Ahmad 17


COMPUTER SCIENCE FOR CLASS 10
Long Questions
UNIT # 3
Conditional Logic

Q1: A marketing firm calculates the salary of its employees according to the following
formula.
Gross Salary = Basic Salary +(Number of Items Sold X 8) + Bonus
If the number of sold items are more than 100 and the number of broken items are
0, then bonus is Rs. 10000, otherwise bonus is 0.
Write a program that takes basic salary, the number of sold and broken items as
input from user, then calculates and displays the gross salary of the employee.
Ans: #include <stdio.h>
void main()
{
int basic_salary, items_sold, items_broken, gross_salary;
int bonus;
printf(“Enter the basic salary: ”);
scanf(“%d”, &basic_salary);
printf(“Enter the number of items sold: ”);
scanf(“%d”, &item_sold);
printf(“Enter the number of items broken: ”);
scanf(“%d”, &items_broken);
if(items_sold > 100 && items_broken == 0)
bonus = 10000;
gross_salary = basic_salary + ( items_sold * 8 ) + bonus ;
printf( “ Gross salary of the employee is %d ” , gross_salary );
}
Q2: An electricity company calculates the electricity bill according to the following
formula.

Bill Amount = Number of Units Consumed X Unit Price


There are two types of electricity users i.e. Commercial and Home Users. For
commercial and home users the unit price varies according to the following:

Units Consumed Unit price


Units < = 200 Rs. 12
Home Users Units > = 200 but Units < = 400 Rs. 15
Units > 400 Rs. 20
Units < = 200 Rs. 15
Commercial Users Units > = 200 but Units < = 400 Rs. 20
Units > 400 Rs. 24

Created By: Bilal Ahmad 18


Write a program that takes the type of consumer and number of units consumed
as input. The program then displays the electricity bill of the users.
Ans: #include <stdio.h>
void main()
{
int units, unit_price, bill;
char user_type;
printf (“ Please enter h for home user and c for commercial user: ”);
scanf(“ %c ” , &user_type);
printf (“ Please enter the number of units consumed: ”);
scanf(“ %d ” , &units);
if( units <= 200 )
if( user_type == ‘h’ )
unit_price = 12;
else if( user_type == ‘c’ )
unit_price = 15;
else if( unit > 200 && units <= 400 )
if( user_type == ‘h’ )
unit_price = 15;
else if( user_type == ‘c’ )
unit_price = 20;
else if( user_type == ‘h’ )
unit_price = 20;
else if( user_type == ‘c’ )
unit_price = 24;
bill = units * unit_price;
printf(“ Your electricity bill is %d” , bill);
}

Q3: Write a program that displays larger one out of the three given numbers.
Ans: #include <stdio.h>
void main()
{
int n1, n2, n3;
printf(“ Enter three numbers ”);
scanf (“%d%d%d” , &n1, &n2, &n3);
if( n1 > n2 && n1 > n3 )
printf(“ The largest number is %d ”, n1 );
else if( n2 > n3 && n2 > n1 )
printf(“ The largest number is %d ”, n2 );
else
printf(“ The largest number is %d ”, n3 );
}

Q4: Write a program that calculates the volume of cube, cylinder or sphere, according
to the choice of user.
Ans: #include <stdio.h>
void main()
{
int choice;
float volume;
printf(“Find Volume \n”);
printf(“1.Cube \n 2.Cylinder \n 3.Sphere \nEnter your choice”);
Created By: Bilal Ahmad 19
scanf(“%d” , &choice);
if( choice ==1 )
{
float length;
printf(“ Enter Length: ”);
scanf(“ %f ” , &lenth);
volume = length * length * length;
printf(“ Volume is %f ” , volume);
}
else if ( choice == 2 )
{
float length1, radius1;
printf(“ Enter Length: ”);
scanf(“ %f ” , &length1);
printf(“ Enter Raduis: ”);
scanf(“ %f ” , &radius1);
volume = 3.142 * radius1 *radius * length1;
printf(“ Volume is %f ” , volume );
}
else if( choice == 3 )
{
float radius;
printf(“Enter Radius: ”);
scanf(“ %f ” , &radius);
volume = 3.142 * radius * radius * radius ;
printf(“ Volume is %f ” , volume );
}
else
printf(“ Invalid Choice ”);
}

Created By: Bilal Ahmad 20

You might also like