0% found this document useful (0 votes)
2 views6 pages

Decision Control Statement

The document outlines a series of programming tasks to be implemented in C, including determining the quadrant of a coordinate point, checking admission eligibility based on marks, calculating electricity bills, and validating triangles. It also includes various coding exercises involving conditional statements, loops, and switch cases. Additionally, there are examples of code snippets with expected outputs for practice.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views6 pages

Decision Control Statement

The document outlines a series of programming tasks to be implemented in C, including determining the quadrant of a coordinate point, checking admission eligibility based on marks, calculating electricity bills, and validating triangles. It also includes various coding exercises involving conditional statements, loops, and switch cases. Additionally, there are examples of code snippets with expected outputs for practice.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Decision Control Statement

1. Write a C program to accept a coordinate point in a XY coordinate system and determine in which
quadrant the coordinate point lies.
2. Write a C program to find the eligibility of admission for a professional course based on the
following criteria:
Marks in Maths >=65
Marks in Phy >=55
Marks in Chem>=50
Total in all three subject >=180
3. Write a C program to input electricity unit charges and calculate total electricity bill according to the
given condition:
For first 50 units Rs. 0.50/unit
For next 100 units Rs. 0.75/unit
For next 100 units Rs. 1.20/unit
For unit above 250 Rs. 1.50/unit
An additional surcharge of 20% is added to the bill
4. Write a C program to input the cost price , selling price and maintenance price of the product and
then calculate profit or loss along with profit/loss percentage.
5. Write a C program to input any character and check whether it is alphabet, digit or special character.
6. Suppose you start writing a C program at time T1 (hh:mm:ss). At time T2 (hh:mm:ss) coding is
finished. After compiling code, you get an error, and it took you T3 (hh:mm:ss) time to fix the error.
Write a program to find the total time (hh:mm:ss) that you spent in executing this program.
7. Write a C program to input all sides of a triangle and check whether triangle is valid or not.
8. Write a C program to input grades and credits of five subjects Physics, Chemistry, Biology,
Mathematics and Computer. Find the SPI of student according to the university rule and print the
Grade based on SPI.
9. Write a C Program to find weather an entered year is leap or not.
10. Write a C program to input any character and if its uppercase alphabet then convert it into lowercase
alphabet and vice versa using switch case.
11. Write a C program to find largest of three numbers using nested if-else.
12. Write a C Program to find largest of two numbers using switch case.
13. Write a program to calculate age of a person based on his given date of birth.
14. The output of the code below is (When 1 is entered).

#include <stdio.h>
void main()
{
char ch;
printf("enter a value btw 1 to 3:");
scanf("%c", &ch);
switch ( ch )
{
case "1":
printf("1");
break;
case "2":
printf("2");
break;
}
}
What will be the output of the following programs?

15. #include <stdio.h>

void main()
{
int x = 5;
if (x >1)
printf("hello");
else if (x == 5)
printf("hi");
else
printf("no");
}

16. #include <stdio.h>

void main()
{
int x = 5;
if (x < 1);
printf("Hello");
}

17. #include<stdio.h>

main()
{
int a = 2, b = 4, c = 8, x = 4;
if ( x == b)
x = a;
else
x = b;
if( x != b)
c = c + b;
else
c = c + a;
printf(“c = %d\n”,c);
}

18. #include<stdio.h>
int main()
{
int a = 5;
switch( a )
{
case 1:
printf("First");
case 2:
printf("Second");
case 3 + 2:
printf("Third");
case 5:
printf("Final");
break;
}
return 0;
}

19. #include<stdio.h>

main()
{
unsigned short int x = -10; int y = 10;
if ( y <= x)
printf( “He is good\n”);
if ( y == ( x = -10))
printf( “She is better\n”);
if (( int) x == y)
printf(“it is the best\n”);
}

20. What will be the output of following program?

#include <stdio.h>
int main()
{ int a = 4;
switch (a) {
default:
printf("DEFAULT");
case 1:
printf("ONE");
case 2:
printf("TWO");
case 3:
printf("THREE");
}
}

What will be the output of following programs?


21.#include<stdio.>
void main()
{
int y=10;
if(y++>9 && y++!=10 && y++>11)
printf("%d", y);
else
printf("%d", y);
}
22. #include<stdio.h>
void main()
{
int y=10;
if(y++>9 && y++!=11 && y++>11)
printf("%d", y);
else
printf("%d", y);
}
23. #include<stdio.h>
voidmain()
{
int a, b=7;
a = b<4 ? b<<1 : ++b>4 ? 7>>1 : a;
printf("%d %d", a, b);
}
24.
#include<stdio.h>
void main()
{
int a=10, b=11, c=13, d;
d = (a=c, b+=a,
c=a+b+c);
printf("%d %d %d %d", d, a, b, c);

25. #include<stdio.h>
void main()
{
int w=10, x=5, y=3, z=3;
if( (w<x) && (y=z++) )
printf("%d %d %d %d", w, x, y, z);
else
printf("%d %d %d %d", w, x, y, z);
}
26. #include<stdio.h>
void main()
{
int movie=1;
switch(movie<<2+movie)
{
default:printf("3 Idiots");
case 4: printf(" Ghajini");
case 5: printf(" Krrish");
case 8: printf(" Race");
}
}
27. Write a program to calculate the parking charges of a vehicle. Enter the type of
vehicle as a character(like c for car, b for bus, etc.) and number of hours then
calculate the parking charge given below-
Truck/Bus- Rs. 20 per hour
Car- 10 Rs. per hour
Scooter /Motorcycle- Rs 5 per hour

You might also like