DEVTOME.COM HOSTING COSTS HAVE BEGUN TO EXCEED 115$ MONTHLY. THE ADMINISTRATION IS NO LONGER ABLE TO HANDLE THE COST WITHOUT ASSISTANCE DUE TO THE RISING COST. THIS HAS BEEN OCCURRING FOR ALMOST A YEAR, BUT WE HAVE BEEN HANDLING IT FROM OUR OWN POCKETS. HOWEVER, WITH LITERALLY NO DONATIONS FOR THE PAST 2+ YEARS IT HAS DEPLETED THE BUDGET IN SHORT ORDER WITH THE INCREASE IN ACTIVITY ON THE SITE IN THE PAST 6 MONTHS. OUR CPU USAGE HAS BECOME TOO HIGH TO REMAIN ON A REASONABLE COSTING PLAN THAT WE COULD MAINTAIN. IF YOU WOULD LIKE TO SUPPORT THE DEVTOME PROJECT AND KEEP THE SITE UP/ALIVE PLEASE DONATE (EVEN IF ITS A SATOSHI) TO OUR DEVCOIN 1M4PCuMXvpWX6LHPkBEf3LJ2z1boZv4EQa OR OUR BTC WALLET 16eqEcqfw4zHUh2znvMcmRzGVwCn7CJLxR TO ALLOW US TO AFFORD THE HOSTING.

THE DEVCOIN AND DEVTOME PROJECTS ARE BOTH VERY IMPORTANT TO THE COMMUNITY. PLEASE CONTRIBUTE TO ITS FURTHER SUCCESS FOR ANOTHER 5 OR MORE YEARS!

C Examples

Hello World Example

This bare bones program will output “Hello World!”

#include <stdio.h>
int main(void) {
    printf("Hello World!");
getch();
return 0;
}

Simple Interest Calculator

This simple program will calculate simple interest.

#include <stdio.h>
int main(void) {
    double principal, rate, time, afterrate, result;
    printf("Type in the amount of money you want to start off with: ");
    scanf("%lf",&principal);
    printf("Type in the rate in percentage (Without the Percent sign): ");
    scanf("%lf",&rate);
    rate = rate * 0.01;
    printf("Type in the time in months: ");
    scanf("%lf",&time);
    time = time/12;
    printf("Money: %lf\nRate: %f\nTime: %f Year(s)", principal, rate, time);
    afterrate = principal * rate;
    result = afterrate + principal;
    printf("\n\nResult: %f", result);
getch();
return 0;
}

Devcoin Payout Time Estimator

This simple program will estimate the amount of days it takes for a selected amount of block to be mined to another block.

#include <stdio.h>
int main(void){
    int currentblock, payoutblock, blocksinaday, blocksleft, daysleft;
    
    printf("\nEnter the current block number: ");
    scanf("%d", &currentblock);
    printf("\nEnter the payout block number: ");
    scanf("%d", &payoutblock);
    blocksleft = payoutblock - currentblock;
    daysleft = blocksleft/120;
    printf("%d Days left for payout!", daysleft);
    
getch();
return 0;   
}

Devcoin Share Calculator

This simple program calculates the amount of shares written, and as well outputs the amount of Devcoins you will receive.

#include <stdio.h>
int main(void){
    int wordcount, shares, devcoinspershare, devcoins;
    double myshares;
    printf("\nEnter the amount of words you have written: ");
    scanf("%d", &wordcount);
    printf("\nEnter the amount of shares there are: ");
    scanf("%d", &shares);
    myshares = wordcount/1000;
    devcoinspershare = 180000000/shares;
    devcoins = devcoinspershare * myshares;
    printf("You are going to earn %d devcoins!", devcoins);
getch();
return 0;   
}

Devcoin Payout Calculator

This simple program calculates Devcoins to either Bitcoins or Litecoins along with the USD.

#include <stdio.h>
#include <stdbool.h>

int main(void) {
    float devcoins, rate, moneyresult, result, convert, converttousd;
    char type, skip;
    printf("Type B for Bitcoin, or L for Litecoin: ");
    scanf("%c", &type);
    switch (type) {
           case 'b':
           case 'B':
               printf("Bitcoin Selected!\n");
               printf("Type the amount of DevCoins you have: ");
               scanf("%f", &devcoins);
               printf("Type the conversion rate for one Devcoin to a Bitcoin: ");
               scanf("%f", &rate);
               result = devcoins * rate;
               printf("Type the conversion rate for one Bitcoin to USD: ");
               scanf("%f", &converttousd);
               moneyresult = result * converttousd;
               printf("\n\nResult: $%f", moneyresult);
               printf("\nResult: %f Bitcoin(s)", result);
           break;

           case 'l':
           case 'L':
               printf("Litecoin Selected!\n");
               printf("Type the amount of DevCoins you have: ");
               scanf("%f", &devcoins);
               printf("Type the conversion rate for one Devcoin to a Litecoin: ");
               scanf("%f", &rate);
               result = devcoins * rate;
               printf("Type the conversion rate for one Litecoin to USD: ");
               scanf("%f", &converttousd);
               moneyresult = result * converttousd;
               printf("\n\nResult: $%f", moneyresult);
               printf("\nResult: %f Litecoins(s)", result);
          break;
          
          default:
          printf("Not a valid type!");
          }

getch();
return 0;
}

computing | programming


QR Code
QR Code c_examples (generated for current page)
 

Advertise with Anonymous Ads