Sep 18 2009

If & Else if

Category: C Programmingadmin @ 11:07 pm

/*represent the if,else if */
#include<stdio.h>
main()
{
      int age1,age2;
      printf("Enter your age:");
      scanf("%d",&age1);
      printf("Your age is %d\n",age1);
      age2=30;
      printf("My age is %d\n",age2);
 
      if (age1>age2)
      {
        printf("I'm younger Than You :D\n");
        printf("You are %d years elder than me",age1-age2);
      } 
      else if(age1==age2)
        printf("We are in same age"); 
 
      else
        printf("I'm elder Than You");
 
       fflush(stdin);
       getchar();
}

Tags: , , ,


Sep 15 2009

Temp Converter

Category: C Programmingadmin @ 4:50 am

/*Convert a Celsius temperature to Fahrenhit*/
#include<stdio.h>
main()
{
      float tmpc;
      float tmpf;
      printf("Enter Celsius temperature:");
      scanf("%f",&tmpc);
      tmpf=32+tmpc*9/5;
      printf("Farenhit temperature:%.2f\n",tmpf);
 
      fflush(stdin);
      getchar();
}

Tags: , ,


Aug 26 2009

Hello World

Category: C Programmingadmin @ 7:25 pm

C is one of the most popular programming languages. It is widely used on many different software platforms, and there are few computer architectures for which a C compiler does not exist. C has greatly influenced many other popular programming languages, most notably C++, which originally began as an extension to C

/* Program 1.0 My Very First C Program - Displaying Hello World */
#include<stdio.h>
main()
{
      printf("Hello World!\n");
}

Tags: , ,


« Previous Page