INTRODUCTION 

C is a mother language and High Level Programming Language. C Language Developed by Dennis Retchie in Bells Lab at 1972 approximately after 23 year of efforts. C is a structured Language and easy to use.


C Programming Tutorial 1
cprogrammingtutorial1


Write a Hello World Program in C Language

Hello World in C Programming
Hello World


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

Output:

Hello World

Write a Program which calculate two numbers?

Two Number Summation by assigning in c
summation in c


#include<stdio.h>
void main()
{
 int num1=10;
int num2=20;
int sum;
sum=num1+num2;
printf("Sum=%d\n", sum);
}

Output:

Sum = 30

Write a Program which calculate two numbers by user input ?



#include<stdio.h>
void main()
{
 int num1;
int num2;
int sum;
printf("Enter Number1:");
scanf("%d",&num1);
printf("Enter Number2:");
scanf("%d",&num2);
sum=num1+num2;
printf("Sum=%d\n", sum);
}

Output

Enter Number1:100
Enter Number2:200
Sum=300


Write a Program to print your name roll no and age ?


#include<stdio.h>
void main()
{
char name="John";
int rollno=12;
float age=23.5;
printf("Name=%c",name);
printf("Roll No=%d",rollno);
printf("Age=%f",age);

}

Output

Name=John
Roll No=12
Age=23.5

Write a Program swap the value of two numbers?


#include<stdio.h>
void main()
{
 int x=10,y=20, temp;
temp=x;
x=y;
y=temp;
printf("Value of after swaping %d\n",x);
printf("Value of after swaping %d\n",y);
}

Output

x=20
y=10


Write a to calculate the per unit price of product if total price and per pack price are given?

#include<stdio.h>
void main()
{
float per_unit_price;
float total_pieces;
float pack_price;
printf("Enter total price of pack");
scanf("%f\n",&pack_price);
printf("Enter Total Number of pieces inside pack");
scanf("%f\n",&total_pieces);
per_unit_price=pack_price/total_pieces;
printf("Per Unit Price =%f",per_unit_price);

}

Output:

Enter Total Price of Pack: 680
Enter Total Number of Pieces inside pack=30
Per unit Price =22