Test: are there three sides of a triangle ?

Sunday, July 4, 2010

 // C08_Ex 9: Input 3 whole number.// 3 This is an integer form three sides of a triangle or not ?// If so, what is the triangle?#include <stdio.h>void main(){    int a, b, c;    printf("Input 3 whole number: ");    scanf("%d%d%d", &a, &b, &c);    if (a + b > c && a + c > b && b + c > a)    {      ...
Read more »

Get number of days in month

Friday, July 2, 2010

 // C08_Ex 8: Input month,year// Output dates of this month#include <stdio.h>void main(){    int month, yr, result;       printf("Input month,year: ");    scanf("%d%d", &month, &yr);       if (month>=1 && month<=12)    {        switch (month)        {  ...
Read more »

Checkout cost of taxi

Tuesday, June 29, 2010

// C08_Ex 7: Checkout cost of taxi from kilometer input. Known:// First km: 5$// 2 -> 5 km price: 4$// 6 km -> price:  3$// If > 120km , will sale 10% #include <stdio.h>#define G1 5#define G2 4#define G3 3void main(){    int n;    float cost;    printf("Input numbers of km (>0): ");    scanf("%d", &n);    if (n == 1)      ...
Read more »

 
 
 
 
Copyright © 2010 C Source Code - C++ Source Code. All Rights Reserved. Using Xclear Theme | Bloggerized by Themescook Developed by Helios | Powered by Blogger