Introduc) On To C Programming Lab Assignments 5 (Batch B) : Input Format
Introduc) On To C Programming Lab Assignments 5 (Batch B) : Input Format
2. Chef and Chefina are playing with dice. In one turn, both of them roll their dice at
once. They consider a turn to be good if the sum of the numbers on their dice is
greater than 6. Given that in a particular turn Chef and Chefina got X and Y on their
respective dice, find whether the turn was good.
Input Format
• The first line of input will contain a single integer T, denoting the number of test
cases.
• Each test case contains two space-separated integers X and Y — the numbers Chef
and Chefina got on their respective dice.
Output Format
For each test case, output on a new line, YES, if the turn was good and NO otherwise.
Each character of the output may be printed in either uppercase or lowercase. That is, the
strings NO, no, nO, and No will be treated as equivalent.
Constraints
• 1≤T≤100
• 1≤X,Y≤6
Sample 1:
Input Output
4
1 4 No
3 4 YES
4 2 NO
2 6 YES
Explanation:
Test case 1: The sum of numbers on the dice is 1+4=5 which is smaller than 6. Thus, the turn
is not good.
3. You're a bit all over the place as a college student. You used to eat out at expensive
restaurants almost every day until your parents gave you a talking-to about being
irresponsible. Now, you've got to control your eating and spending habits.
So, here's the plan: you'll stick to the college mess for your meals every day, except Sundays.
On Sundays, you're treating yourself to those fancy restaurant meals.
The cost is Rs. X for the mess food each day, and Rs. Y for the restaurant splurges.
Now, what's the cost of food per week? Note that you don't have to pay for the mess on
Sundays.
A week has seven days, as usual.
Input Format
• The first and only line of input contains 2 space-separated integers, X and Y.
Output Format
Constraints
• 1≤X<Y≤1000
Sample 1:
Input
100 500
Output
1100
4. Write a C program without using if-else construct that does the following.
It accepts a sequence of posiBve integers between 1 and 9 both inclusive from the key-
board. The program will stop accepBng input once an integer outside the range is entered.
The program will finish by prinBng the total number mulBples of 3 and total number of
even integers entered.
6. Write a C program to count the number of vowels and the number of consonants
in a word.
7. Write a C program to display and find the sum of the series 1+11+111+....111 upto n.
For eg. if
n=4, the series is : 1+11+111+1111. Take the value of 'n' as input from the user.
9. Write a C program to check if a number has three consecuBve 5. If yes, print YES, else
print NO.
Example:
Number: 1353554
Result: NO
Number: 345559
Result: YES
10. The given number is ugly prime number if it's prime factor contains only among 2,3 or
5. e.g. 20= 2*2*5 is ugly prime number and 14=2*7 is not a ugly prime number. So
write a C funcBon which takes values from 1 to n and returns the number of ugly
primes number in it.
Example:
input: 20 output: 3