c ppt1
c ppt1
NAME:LAMBU.VYSHNAVI
ROLL NO:21951A67J6
BRANCH:CSD-C
SUBJECT: PROGRAMMING
FOR PROBLEM SOLVING
Increasing covid Cases have created panic
amongst the people of Lemoland,so the
government is starting to push for production of
a vaccine.It has to report to the media about
the exact date when vaccines will be
available.There are two companies which are
producing vaccines for covid.Company A starts
producing vaccines on day D1 and it can
Produce V1 vaccines per day. Company B starts
producing vaccines on day D2 and It can
Produce V2 vaccines per day. Currently,we are
on day1. We need a total of P vaccines. How
many days are required to produce enough
Structure of a C program:
Header Files Inclusion:
The first and foremost component is the inclusion of
the Header files in a C program.
A header file is a file with extension .h which contains
C function declarations and macro definitions to be
shared between several source files.
while(condit
Syntax: ion) {
The syntax of a while loop in C
programming language is −
statement(s
);
}
Here, statement(s) may be
a single statement or a
block of statements.
The condition may be any
expression, and true is
any nonzero value. The
loop iterates while the
condition is true.
When the condition
becomes false, the
program control passes to
the line immediately
following the loop.
If Statement:
An if statement consists of a Boolean
expression followed by one or more
statements.
Syntax
The syntax of an 'if' statement in C programming
language is −
INPUT: OUTPUT:
1 2 1 3 14 3
Explanation:
Since D1= D2= 1, we can produce V1+V2
=5 vaccines per day. In 33 days, we
produce 1515 vaccines, which satisfies our
requirement of 1414 vaccines
INPUT: OUTPUT:
5 4 2 10 100 9
Explanation:
There are 00 vaccines produced on the first
day, 1010 vaccines produced on each of
days 22, 33 and 44, and 1414 vaccines produced on
the fifth and each subsequent day. In 99 days, it
makes a total of 0 + 10 \cdot 3 + 14 \cdot 5 =