SlideShare a Scribd company logo
C programs
1. C program to find average of two numbers
2. C program to find distance between two ponts
Sqrt( (x2-x1)2 + (y2-y2)2)
3. C program to find area and circumference of circle .
area =∏r2 circumference =2 ∏r
4. C program to find area and perimeter of rectange
area = length * width
Perimeter = 2(length + width)
5. C program to print ACII value of character
6. C program to convert Fahrenheit to degree Celsius
C = (0.56) *(F-32)
7. C program to swap two variables with temporary
variable
8. C program to swap two variables without temporary
variable
9. C program to print area of triangle
S=(a+b+c)/2
area = sqrt(s (s-a)(s-b) (s-c) )
10.C program to convert uppercase to lowercase and
lowercase to uppercase letter
Program2:
#include<stdio.h>
#include<math.h>
int main()
{
float x1,x2,y1,y2,dist;
printf("Enter x1 and x2n");
scanf("%f%f",&x1,&x2);
printf("Enter y1 and y2 n ");
scanf("%f%f",&y1,&y2);
dist = sqrt(pow((x2-x1),2)+pow((y2-y1),2));
printf("Distance between two points : %fn",dist);
return 0;
}
Program 3:
#include<stdio.h>
#define PI 3.1416
int main()
{
float area, radius , cir;
printf("Enter the radius of the circlen");
scanf("%f", &radius);
area = PI * radius * radius;
cir = 2* PI * r ;
printf("The area of the circle is: %fn", area);
printf("The circumference of the circle is: %fn",cir);
}
Program 5:
#include<stdio.h>
int main()
{
char ch ;
printf(“enter a character n”);
scanf(“%c”,&ch);
printf(“the Ascii value of character is %d”,ch);
return 0;
}
#include<stdio.h>
int main()
{
char ch, upper,lower;
printf(“enter a character n”);
scanf(“%c”,&ch);
lower = ch + 32;
upper = ch - 32;
printf(“the lower case of character is %c”,lower);
printf(“the upper case of character is %c”,upper);
return 0;
}
#include<stdio.h>
int main()
{
int a, b, temp;
printf(“enter a and b valuesn”);
scanf(“%d%d”,&a,&b);
temp = a;
a = b ;
b = temp;
printf(“after swapping a value is %dn”,a);
printf(“after swapping b value is %dn”,b);
return 0;
}
#include<stdio.h>
int main()
{
int a, b;
printf(“enter a and b valuesn”);
scanf(“%d%d”,&a,&b);
a = a + b ;
b = a – b ;
a = a – b ;
printf(“after swapping a value is %dn”,a);
printf(“after swapping b value is %dn”,b);
return 0;
}
#include<stdio.h>
int main()
{
float C, F;
printf("Enter the Fahrenheit n");
scanf("%f", &F);
C = 0.56 *(F-32);
printf(" Fahrenheit to degree Celsius %fn", C );
return 0;
}
#include<stdio.h>
int main()
{
float C, F;
printf("Enter the Celsius n");
scanf("%f", &C);
F = (1.8 * C) + 32;
printf(" Fahrenheit to degree Celsius %fn", C );
return 0;
}

More Related Content

Similar to c programs.pptx

C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
Koshy Geoji
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkar
sandeep kumbhkar
 
LET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERS
KavyaSharma65
 
C lab programs
C lab programsC lab programs
C lab programs
Dr. Prashant Vats
 
C lab programs
C lab programsC lab programs
C lab programs
Dr. Prashant Vats
 
C coding#1
C   coding#1C   coding#1
C coding#1
Sekhar Pisini
 
C programms
C programmsC programms
C programms
Mukund Gandrakota
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solution
yogini sharma
 
Srinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
Srinivas Reddy Amedapu C and Data Structures JNTUH HyderabadSrinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
Srinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
Srinivas Reddy Amedapu
 
Srinivas Reddy Amedapu, CPDS, CP Lab, JNTU Hyderabad
Srinivas Reddy Amedapu, CPDS, CP Lab, JNTU HyderabadSrinivas Reddy Amedapu, CPDS, CP Lab, JNTU Hyderabad
Srinivas Reddy Amedapu, CPDS, CP Lab, JNTU Hyderabad
Srinivas Reddy Amedapu
 
C Programming lab
C Programming labC Programming lab
C Programming lab
Vikram Nandini
 
C basics
C basicsC basics
C basicsMSc CST
 
C programs
C programsC programs
C programs
Vikram Nandini
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++
Ankit Kumar
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]
Abhishek Sinha
 
Numerical analysis
Numerical analysisNumerical analysis
Numerical analysisVishal Singh
 
Najmul
Najmul  Najmul
Najmul
Najmul Ashik
 

Similar to c programs.pptx (20)

C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkar
 
LET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERSLET US C (5th EDITION) CHAPTER 2 ANSWERS
LET US C (5th EDITION) CHAPTER 2 ANSWERS
 
C lab programs
C lab programsC lab programs
C lab programs
 
C lab programs
C lab programsC lab programs
C lab programs
 
2.docx
2.docx2.docx
2.docx
 
C coding#1
C   coding#1C   coding#1
C coding#1
 
C programms
C programmsC programms
C programms
 
Revision1schema C programming
Revision1schema C programmingRevision1schema C programming
Revision1schema C programming
 
Revision1 C programming
Revision1 C programmingRevision1 C programming
Revision1 C programming
 
Best C Programming Solution
Best C Programming SolutionBest C Programming Solution
Best C Programming Solution
 
Srinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
Srinivas Reddy Amedapu C and Data Structures JNTUH HyderabadSrinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
Srinivas Reddy Amedapu C and Data Structures JNTUH Hyderabad
 
Srinivas Reddy Amedapu, CPDS, CP Lab, JNTU Hyderabad
Srinivas Reddy Amedapu, CPDS, CP Lab, JNTU HyderabadSrinivas Reddy Amedapu, CPDS, CP Lab, JNTU Hyderabad
Srinivas Reddy Amedapu, CPDS, CP Lab, JNTU Hyderabad
 
C Programming lab
C Programming labC Programming lab
C Programming lab
 
C basics
C basicsC basics
C basics
 
C programs
C programsC programs
C programs
 
Computer graphics programs in c++
Computer graphics programs in c++Computer graphics programs in c++
Computer graphics programs in c++
 
Concepts of C [Module 2]
Concepts of C [Module 2]Concepts of C [Module 2]
Concepts of C [Module 2]
 
Numerical analysis
Numerical analysisNumerical analysis
Numerical analysis
 
Najmul
Najmul  Najmul
Najmul
 

Recently uploaded

Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
WENKENLI1
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
top1002
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 

Recently uploaded (20)

Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdfGoverning Equations for Fundamental Aerodynamics_Anderson2010.pdf
Governing Equations for Fundamental Aerodynamics_Anderson2010.pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Basic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparelBasic Industrial Engineering terms for apparel
Basic Industrial Engineering terms for apparel
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 

c programs.pptx

  • 1. C programs 1. C program to find average of two numbers 2. C program to find distance between two ponts Sqrt( (x2-x1)2 + (y2-y2)2) 3. C program to find area and circumference of circle . area =∏r2 circumference =2 ∏r 4. C program to find area and perimeter of rectange area = length * width Perimeter = 2(length + width) 5. C program to print ACII value of character 6. C program to convert Fahrenheit to degree Celsius C = (0.56) *(F-32)
  • 2. 7. C program to swap two variables with temporary variable 8. C program to swap two variables without temporary variable 9. C program to print area of triangle S=(a+b+c)/2 area = sqrt(s (s-a)(s-b) (s-c) ) 10.C program to convert uppercase to lowercase and lowercase to uppercase letter
  • 3. Program2: #include<stdio.h> #include<math.h> int main() { float x1,x2,y1,y2,dist; printf("Enter x1 and x2n"); scanf("%f%f",&x1,&x2); printf("Enter y1 and y2 n "); scanf("%f%f",&y1,&y2); dist = sqrt(pow((x2-x1),2)+pow((y2-y1),2)); printf("Distance between two points : %fn",dist); return 0; }
  • 4. Program 3: #include<stdio.h> #define PI 3.1416 int main() { float area, radius , cir; printf("Enter the radius of the circlen"); scanf("%f", &radius); area = PI * radius * radius; cir = 2* PI * r ; printf("The area of the circle is: %fn", area); printf("The circumference of the circle is: %fn",cir); }
  • 5. Program 5: #include<stdio.h> int main() { char ch ; printf(“enter a character n”); scanf(“%c”,&ch); printf(“the Ascii value of character is %d”,ch); return 0; }
  • 6. #include<stdio.h> int main() { char ch, upper,lower; printf(“enter a character n”); scanf(“%c”,&ch); lower = ch + 32; upper = ch - 32; printf(“the lower case of character is %c”,lower); printf(“the upper case of character is %c”,upper); return 0; }
  • 7. #include<stdio.h> int main() { int a, b, temp; printf(“enter a and b valuesn”); scanf(“%d%d”,&a,&b); temp = a; a = b ; b = temp; printf(“after swapping a value is %dn”,a); printf(“after swapping b value is %dn”,b); return 0; }
  • 8. #include<stdio.h> int main() { int a, b; printf(“enter a and b valuesn”); scanf(“%d%d”,&a,&b); a = a + b ; b = a – b ; a = a – b ; printf(“after swapping a value is %dn”,a); printf(“after swapping b value is %dn”,b); return 0; }
  • 9. #include<stdio.h> int main() { float C, F; printf("Enter the Fahrenheit n"); scanf("%f", &F); C = 0.56 *(F-32); printf(" Fahrenheit to degree Celsius %fn", C ); return 0; }
  • 10. #include<stdio.h> int main() { float C, F; printf("Enter the Celsius n"); scanf("%f", &C); F = (1.8 * C) + 32; printf(" Fahrenheit to degree Celsius %fn", C ); return 0; }