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 *