Sunday 28 December 2014

progarm to find area,radius and circumference

#include<stdio.h>

int main()
{
  float len,breth,radius,area1,p,area2,circum;
 
  printf("Enter lenth of rectangle:");
  scanf("%f",&len);
  printf("enter breath of rectangle:");
  scanf("%f",&breth);
  printf("enter radius of circle:");
  scanf("%f",&radius);
 
      area1=len*breth;
      printf("areq of rectangle=%f \n",area1);
      p=2*(len+breth);
      printf("perimeter of rectangle=%f\n",p);
     
      area2=3.14*radius*radius;
      printf("area of radius =%f\n",area2);
     
      circum=2*3.14*radius;
      printf("circumference of circle=%f",circum);
   
  return 0;   
   
}

Program to add,subtract.multiply and divide any numbers

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main()

{
    int x, y ;
   
    printf("enter first value:");
    scanf("%d", &x);
    printf("enter 2nd value:");
    scanf("%d", &y);
   
    printf("sum=%d \n", x+y);
    printf("subtraction=%d \n", x-y);
    printf("multiplication=%d \n", x*y);
    printf("divisin=%d \n", x/y);
   
    system("PAUSE");
    return 0;
}

program to find square of number

#include<stdio.h>
int main()
{
    float num,sqr;
   
    printf("Enter the number:");
    scanf("%f",&num);
       
        sqr=num*num; /* square formula */
    printf("square=%f",sqr);
   
    return 0;
}

Tuesday 23 December 2014

First program

/*first c program in lab */
/*Prints hello world */ 
#include<stdio.h>
#include<conio.h>
main()
      {
                 printf("hello word");
                 getche();
      }