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. ...
Variable & Datatype for C-programming 5 Variable:- Whose value change is known as variable.You can use some specific variable. Ex:-a,b,c A,B,C a1,b2 But 1a,2b, space, special character are not allowed. Underscore is allowed. Datatype:- Before declaration variable you need to define the type of variable i.e. integer, character, float etc Variable declaration:- You can define a variable in following way. Syntax:- datatype variablename; Eg:-int x; int a; float q; Variable intialization:- In this step you have to give the value of variable. During character intialization write character within the ' ' Eg:-int x=1; or int x; x=1; ...
Addition of two numbers in c language #include<stdio.h> int main() { int x,y,z; printf ("Enter two numbers"); scanf("%d%d",&x,&y); z=x+y; printf("Sum of two numbers are=%d",z); } OUTPUT Enter two numbers 4 5 Sum of two numbers are=9 Addition of two number is simple program of C-language.After reading this program you will be able to form simple mathematics addition . 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. Next=>
2. Language Translator 1. Assembler 2. Compiler 3. Interpreter 4. Linker 5. Loader 1.Assembler:- In computer science, assembler is a program which convert assembly level language into machine level language, because computer understand binary language. Machine code ⬆️ ⬆️ Assembler ...
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...
Program to show present time and date in C-language. #include <stdio.h> #include <string.h> int main() { char time[10]; char date[12]; strcpy(time, __TIME__); strcpy(date, __DATE__); printf("%s %s\n", time, date); return 0; } OUTPUT 08:17:09 May 25 2020 The above time and date change according to you when you run the program,So it show different time. If you like this program you can share comments and follow.
Program to search an element using binary search. #include<stdio.h> int main() { int i,a[10],n,b,c=0,l,f,mid; printf("Enter the size limit maximum is 10\n"); scanf("%d",&n); printf("Enter the array element\n"); for(i=0;i<n;i++) { scanf("%d",&a[i]); } printf("Enter the element to be searched\n"); scanf("%d",&b); f=0; l=n-1; while(f<=l) { mid=(f+l)/2; if(b<a[mid]) { l=mid-1; } if(b>a[mid]) { f=mid+1; } else if(b==a[mid]) { ...
Comments
Post a Comment