Introduction of C-language 1. C-language was developed by Dennis Ritchie . In the year 1972 in Bell Laboratory in USA . C language suitable for system programmings ,it was mainly developed for UNIX operating system . Dennis Ritchie (1941-2011) Books:- The C Programming languages Dennis Ritchie also known as father of C-language. Use of C-language 👉🏿Operating system. 👉🏿Language Compiler. 👉🏿Text editor. 👉🏿Modern Program. 👉🏿Database. 👉🏿Language interpreter. 👉🏿Mobile & desktop application. 👉🏿 Gaming & Animation. ...
Program to calculate distance between two points #include<stdio.h> #include<math.h> int main() { float x1,x2,y1,y2,D; printf("Enter the point x1,x2\n"); scanf("%f%f",&x1,&x2); printf("Enter the value of y1,y2\n"); scanf("%f%f",&y1,&y2); D=sqrt(pow((x2-x1),2)+pow((y2-y1),2)); printf("Distance betweent two points=%f",D); } OUTPUT Enter the point x1,x2 4 2 Enter the value of y1,y2 5 1 Distance between two points=4.472136 this program is best example of combination of sqrt and pow function In this program we use these function for calculating distance between two points. If you like this program then you can share it and for any issues you can direct contact with me from Home Page. For regular updates you can also follow my site.
#include<stdio.h> int main() { int a,b,c,d,x,m,rev; printf("Enter four digit numbers\n"); scanf("%d",&x); m=x; a=x%10; x=x/10; b=x%10; x=x/10; c=x%10; x=x/10; d=x%10; x=x/10; rev=a*1000+b*100+c*10+d; if(rev==m) { printf("Enter Number is Palindrome"); } else { printf("Enter number is not Palindrome"); } } OUTPUT Enter four digit numbers 1771 Enter Number is Palindrome
Simple Hello world program in c- language. #include<stdio.h> int main() { printf("Hello world"); } OUTPUT Hello world Hello world is basic program of C-language, from Hello world coding of C-language start. In this program you will be able to print anything like name,text number. If you like this program then you can share it and for any issues you can direct contact with me from Home Page . For regular updates you can also follow my site.
#include<stdio.h> int main() { int i,n,sum=0; printf("Enter the last number\n"); scanf("%d",&n); printf("All even number from 1to %d is\n",n); for(i=2;i<=n;i+=2) { printf("%d ",i); } } OUTPUT Enter the last number 9 All even number from 1 to 9 is 2 4 6 8
Program to cheque enter number is a perfect number or not in C-language #include<stdio.h> int main() { int a,i,s=0; printf("Enter the number\n"); scanf("%d",&a); for(i=1;i<a;i++) { if(a%i==0) { s=s+i; } } if(s==a) { printf("Enter number is perfect number"); } else { printf("Enter number is not perfect number"); } } OUTPUT Enter the number 28 Enter number is perfect number This program help you to cheque enter number is perfect number or not and also this program help you to make logics of coming program. If you like this program then you can share it and for any issues you can direct contact with...
Program to cheque enter number is even or odd in c-language #include<stdio.h> int main() { int x; printf("Enter the number\n"); scanf("%d",&x); if(x%2==0) { printf("Enter number %d is even",x); } else { printf("Enter number %d is odd",x); } } OUTPUT Enter the number 17 Enter number 17 is odd Visit Homepage
Program to print the cube of a number in c-language Method-1 #include<stdio.h> main() { int x,y; printf("Enter the number for cube\n"); scanf("%d",&x); y=(x*x*x); printf ("Cube of the number is=%d",y); } Method-2 #include<stdio.h> #include<math.h> main() { int x,y; printf("Enter the number for cube\n"); scanf("%d",&x); y=pow(x,3); printf ("Cube of the number is=%d",y); } OUTPUT Enter the number for cube 5 Cube of the number=125 This program is perfect example of pow function and also describe the math.h header files. By using this function you can find any power of any number. But in this program it is...
Comments
Post a Comment