0% found this document useful (0 votes)
36 views4 pages

Mehul Bansal 20BCE1220

A team of experts conducted a survey of top colleges in India and prepared a report on the facilities, academics, and infrastructure of 20 universities. The prime minister then asked the experts to make two lists: one list containing the top 10 universities and a second list containing the remaining 10 universities. A C program is presented that takes university names as input and outputs the universities in two lists as requested.

Uploaded by

Mehul Bansal
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)
36 views4 pages

Mehul Bansal 20BCE1220

A team of experts conducted a survey of top colleges in India and prepared a report on the facilities, academics, and infrastructure of 20 universities. The prime minister then asked the experts to make two lists: one list containing the top 10 universities and a second list containing the remaining 10 universities. A C program is presented that takes university names as input and outputs the universities in two lists as requested.

Uploaded by

Mehul Bansal
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/ 4

Name: Mehul Bansal

Reg No. 20BCE1220

A team of experts formed under the supervision of the prime minister


of India conducted a survey on some of the top colleges of India. They were
sent to most of the institutions to check on the facilities, academics and
infrastructure. The experts’ team then gave a report of 20 top universities in
India to the prime minister. Prime minster then asks them to make two lists –
One list containing the top10 universities and the second list containing
the remaining universities. Write a C program to depict the above scenario and
display the results.
#include<stdio.h>
#include<string.h>
int main()
{
char arr[6][50];
for (int i = 0; i < 6; i++)
{
char name[50];
fgets(name, 50, stdin);
strcpy(arr[i], name);
}
char list1[2][50];
for (int i = 0; i < 2; i++)
{
strcpy(list1[i],arr[i]);
}
char list2[4][50];
for (int i = 0; i < 4; i++)
{
strcpy(list2[i],arr[i+2]);
}
printf("\nList 1\n");
for (int i = 0; i < 2; i++)
{
printf("%s", list1+i);
}
printf("List 2\n");
for (int i = 0; i < 4; i++)
{
printf("%s", list2+i);
}
}
A cafe sells two types of cola drinks. The drinks each come in three sizes: small, medium and
large. At the beginning of the day the fridge was stocked with the number of units shown in
the matrix below. At the end of the day the stock was again counted.

Implement the program to calculate the total profit made for the day from the sale of these
drinks.

#include<stdio.h>
int main()
{
int start[2][3];
int end[2][3];
printf("At the Start of the day\n");
printf("Brand C\n");
printf("Small: ");
scanf("%d",&start[0][0]);
printf("Medium: ");
scanf("%d",&start[0][1]);
printf("Large: ");
scanf("%d",&start[0][2]);
printf("Brand P\n");
printf("Small: ");
scanf("%d",&start[1][0]);
printf("Medium: ");
scanf("%d",&start[1][1]);
printf("Large: ");
scanf("%d",&start[1][2]);
printf("At the end of the day\n");
printf("Brand C\n");
printf("Small: ");
scanf("%d",&end[0][0]);
printf("Medium: ");
scanf("%d",&end[0][1]);
printf("Large: ");
scanf("%d",&end[0][2]);
printf("Brand P\n");
printf("Small: ");
scanf("%d",&end[1][0]);
printf("Medium: ");
scanf("%d",&end[1][1]);
printf("Large: ");
scanf("%d",&end[1][2]);
float profit[3];
printf("Profit per cup\n");
printf("Small: ");
scanf("%f",&profit[0]);
printf("Medium: ");
scanf("%f",&profit[1]);
printf("Large: ");
scanf("%f",&profit[2]);
double profit_small;
double profit_medium;
double profit_large;
double total_profit;
profit_small=(double)((start[0][0]+start[1][0]-end[0][0]-
end[1][0])*profit[0]);
profit_medium=(double)((start[0][1]+start[1][1]-end[0][1]-
end[1][1])*profit[1]);
profit_large=(double)((start[0][2]+start[1][2]-end[0][2]-
end[1][2])*profit[2]);
printf("Total profit from Small: %.2f\n", profit_small);
printf("Total profit from Medium: %.2f\n", profit_medium);
printf("Total profit from Large: %.2f\n", profit_large);
total_profit=profit_large+profit_medium+profit_small;
printf("Total Profit: %.2f\n", total_profit);
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy