Freelancing(Developer & Trainer). Undertaking projects/assignments. Open for short & long term contracts.
⚡ C Programming 🔥 Ninja's Shopping #tecqmate
Get link
Facebook
X
Pinterest
Email
Other Apps
#include<stdio.h>
void main(){
int shops;
printf("How many shops will you be visiting? ");
fflush(stdin);
scanf("%d", &shops);
int inds, shop;
float cost, sum, min = 0.0f;
for(int i = 1, j; shops >= i; i++){
printf("You are at shop #%d. How many ingredients do you need at shop #%d? ", i, i);
scanf("%d", &inds);
sum = 0.0f;
for(j = 1; inds >= j; j ++){
printf("How much is ingredient #%d? ", j);
scanf("%f", &cost);
sum += cost;
}
if(1 == i || min > sum){
min = sum;
shop = i;
}
printf("Your total at shop #%d is $%.2f.\n", i, sum);
}
printf("Your cheapest order was at shop #%d and cost $%.2f.\n", shop, min);
}
Introduction: Before you can start coding in PHP, you need to set up the development environment by installing PHP on your machine. In this blog post, we'll walk you through the process of installing PHP on different operating systems, ensuring you have everything you need to begin your PHP programming journey. Table of Contents: 1. Installing PHP on Windows 2. Installing PHP on macOS 3. Installing PHP on Linux 4. Verifying the PHP Installation 5. Configuring PHP Let's dive into each section and learn how to install PHP on your preferred operating system. 1. Installing PHP on Windows: Step-by-step instructions on installing PHP on a Windows machine. We'll cover the installation of XAMPP, a popular PHP development environment that includes Apache, MySQL, and PHP. 2. Installing PHP on macOS: A detailed guide on installing PHP on macOS using Homebrew, a package manager for macOS. We'll walk you through the installation of PHP and configuring Apache. 3. Installing PHP on ...
Comments
Post a Comment