0% found this document useful (0 votes)
15 views

Assignment 1

This document contains 7 code snippets that demonstrate basic C programming concepts like input/output, variables, operators, and functions. The snippets include printing text, calculating the area and perimeter of a rectangle, getting user input to calculate the area and circumference of a circle, swapping two numbers, converting between Fahrenheit and Celsius, and calculating an employee's gross salary.

Uploaded by

meghnabagchi23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Assignment 1

This document contains 7 code snippets that demonstrate basic C programming concepts like input/output, variables, operators, and functions. The snippets include printing text, calculating the area and perimeter of a rectangle, getting user input to calculate the area and circumference of a circle, swapping two numbers, converting between Fahrenheit and Celsius, and calculating an employee's gross salary.

Uploaded by

meghnabagchi23
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

#include<stdio.

h>

#include<conio.h>

int main()

printf("\"Hello World!\"");

}
#include<stdio.h>

#include<conio.h>

int main()

printf("\n Name \t\t Meghna Bagchi \n Roll number\t 002310701016");

}
#include<stdio.h>

#include<conio.h>

int main()

int ln=9,br=6;

printf("\n The length of the rectangle is %d ",ln);

printf("\n The breadth of the rectangle is %d",br);

printf("\n The perimeter of the rectangle is %d",2*(ln+br));

printf("\n The area of the rectangle is %d",(ln*br));

}
#include<stdio.h>

#include<conio.h>

int main()

float r, area,cir;

printf("Enter radius");

scanf("%f",&r);

area=(22.0/7.0)*r*r;

cir=2.0*(22.0/7.0)*r;

printf("\n The area of the circle is %0.2f units",area);

printf("\n The circumference of the circle is %0.2f units",cir);

return 0;

}
#include<stdio.h>

#include<conio.h>

int main()

int num1,num2;

printf("\n Enter first number:");

scanf("%d",& num1);

printf("\n Enter second number:");

scanf("%d",& num2);

num1=num1+num2;

num2=num1-num2;

num1=num1-num2;

printf("\n The first number is %d",num1);

printf("\n The second number is %d",num2);

return 0;

}
#include<stdio.h>

#include<conio.h>

int main()

float far,cel;

printf("\n Enter temperature in Fahrenheit:");

scanf("%f",& far);

cel=(5.0/9.0)*(far-32.00);

printf("\n Temperature in Celsius %0.2f",cel);

return 0;

}
#include<stdio.h>

#include<conio.h>

int main()

float bs,da,hra,gross;

printf(" \n Enter basic salary:");

scanf("%f",&bs);

da=0.60*bs;

hra=0.15*bs;

gross=bs+da+hra;

printf("\n Dearness allowance: %0.2f \n House rent allowance: %0.2f",da,hra);

printf("\n Gross salary: %0.2f",gross);

return 0;

You might also like