Warning: sizeof(): Parameter must be an array or an object that implements Countable in /homepages/9/d213665487/htdocs/clickandbuilds/CoalGeology/wp-content/plugins/wordpress-firewall.php on line 245

Warning: sizeof(): Parameter must be an array or an object that implements Countable in /homepages/9/d213665487/htdocs/clickandbuilds/CoalGeology/wp-content/plugins/wordpress-firewall.php on line 245

Warning: Cannot modify header information - headers already sent by (output started at /homepages/9/d213665487/htdocs/clickandbuilds/CoalGeology/wp-content/plugins/wordpress-firewall.php:245) in /homepages/9/d213665487/htdocs/clickandbuilds/CoalGeology/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 62
Variable Declaration in C with Example code – Coal Geology and Mining: Consulting Services

Variable Declaration in C with Example code

 

 

 

 

 

// Program for DIVISION AND THE MODULUS OPERATOR
#include <stdio.h>
int main(void)
{
int diamonds = 45; // Number of Diamonds in a store
int ladies = 7; // Number of ladies came to the store
int diamonds_per_lady = 3; // Average Number of diamnods sold
int diamonds_left_over = 0; // Number of diamonds left at the store

 

printf(“You have %d diamonds and %d ladies\n”, diamonds, ladies);
printf(“Average number of diamonds sold is %d.\n”, diamonds_per_lady);

 

diamonds_left_over = diamonds-(ladies*diamonds_per_lady);
printf(“There are %d diamonds left in the store.\n”, diamonds_left_over);
return 0;
}

Capture

Leave a Comment

Your email address will not be published. Required fields are marked *