Search This Blog


Showing posts with label c language. Show all posts
Showing posts with label c language. Show all posts

Monday, 29 April 2019

April 29, 2019

C Program to Calculate square of a number using functions

C Program to Calculate square of a number using functions 

This program to calculate square in c allows the user to enter an integer value and then finds the square of that number using Functions.

From the below code snippet, you can see we are using the Calculate_Square function. When the compiler reaches to Calculate_Square(number) line in main() program, the compiler will immediately jump to int Calculate_Square (int Number) function.

Calculate_Square (int Number) function will calculate the square and return the value.

CODE


#include<stdio.h>

int square(int); // function prototype declaration.

void main()
{
     int number, answer;
   
     printf("Enter your number:");
     scanf("%d", &number);
   
     answer = square(number);  //Call function.
   
     printf("Square of %d is %d.", number, answer);
     }

int square(int n)
{
     //function logic is written here..
     return(n*n); //This will return answer to main function.
}

 OUTPUT

 


Wednesday, 10 April 2019

April 10, 2019

C Program to Ask The User for Empid, Age, Salary and Display the Same || C Programming

Program to Ask The User for Empid, Age, Salary and Display

Hey Coders, Welcome Back.
So this tutorial will help You to Create a program to Take input From users.
And Then Print it Same on the screen.
  
 C program to ask the user details like empid,age,salary and display the same.Program to take input from users and display it.

CODE

#include<stdio.h>

int main()
{
int id,age,salary;

printf("\n ENTER EMPID");
scanf("%d",&id);

printf("\n ENTER AGE");
scanf("%d",&age);


printf("\n ENTER SALARY");
scanf("%d",&salary);

printf("%d",id);
printf("%d",age);
printf("%d",salary);
return 0;
}

OUTPUT



 

Hope you guys learn something watch other blogs too.

Tuesday, 9 April 2019

April 09, 2019

How to Create Any Multiplication Table Using C Language

 MULTIPLICATION TABLE IN C Programming

Hey guys,Welcome back !!

So in this tutorial let us learn how to create any multiplication table using c programming Language.
Creating Table is really Fun. And Personally i really enjoy creating table.

C Program to Generate Multiplication Table Example to generate the multiplication table of a number (entered by the user) using for loop. To understand this example, you should have the knowledge of following C programming topics:

CODE

#include<stdio.h>
int main()
{

int number,i;

printf("ENTER NUMBER");
scanf("%d",&number);


for(i=1;i<=10;i++)
{

printf("%d",number*i);

}

return 0;
}

OUTPUT




April 09, 2019

How To Print Your Name N Number Times in C Programming

Code for "PRINT YOUR NAME N NUMBER OF TIMES" Program in C language

Hey guys welcome back, hope you are enjoying other blogs,so in this Tutorial i am explaining how
to to print Your name For N number of times,where n means the size you will give at the starting.


C program to print a string: it can be printed by using various functions such as printf, puts. A string ends with '\0', it is a character used to mark end of a string. See the following code:

For example if you give your size as 5,then it will print your Name 5 Times.

CODE
#include<stdio.h>                    //header file
void main()
{
int n,i;                                      //variable declaration
printf(" \n HOW MANY TIMES TO PRINT ");
scanf(" %d ", &n);

for(i=0;i<n;i++)                      //For Loop For the size of n 
{
    printf("\n ENTER YOUR NAME");
}
}

OUTPUT

Monday, 8 April 2019

April 08, 2019

Hello World Programm in C | Code Junction

HELLO WORLD IN C LANGUAGE 


A simple C program to display "Hello, World!" on the screen. Since, it's a very simple program, it is often used to illustrate the syntax of a programming language.

At first, lets start with learning with what is C ??


C  is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. By design, C provides constructs that map efficiently to typical machine instructions, and it has therefore found lasting use in applications that were previously coded in assembly language. Such applications include operating systems, as well as various application software for computers ranging from supercomputers to embedded systems. 

C was originally developed at Bell Labs by Dennis Ritchie, between 1972 and 1973. It was created to make utilities running on Unix. Later, it was applied to re-implementing the kernel of the Unix operating system[6]. During the 1980s, C gradually gained popularity. Nowadays, it is one of the most widely used programming languages, with C compilers from various vendors available for the majority of existing computer architectures and operating systems. C has been standardized by the American National Standards Institute (ANSI) since 1989 (see ANSI C) and subsequently by the International Organization for Standardization (ISO). 

C is an imperative procedural language. It was designed to be compiled using a relatively straightforward compiler, to provide low-level access to memory, to provide language constructs that map efficiently to machine instructions, and to require minimal runtime support. Despite its low-level capabilities, the language was designed to encourage cross-platform programming. A standards-compliant C program that is written with portability in mind can be compiled for a wide variety of computer platforms and operating systems with few changes to its source code; the language has become available on various platforms, from embedded microcontrollers to supercomputers. 

Code to print HELLO WORLD !!

#include<stdio.h>
void main()
{
    printf("HELLO WORLD");
}



tags:hello world in c programming
hello world c program example