• Skip to main content
  • Skip to primary sidebar
  • Skip to secondary sidebar
  • Skip to footer

Computer Notes

Library
    • Computer Fundamental
    • Computer Memory
    • DBMS Tutorial
    • Operating System
    • Computer Networking
    • C Programming
    • C++ Programming
    • Java Programming
    • C# Programming
    • SQL Tutorial
    • Management Tutorial
    • Computer Graphics
    • Compiler Design
    • Style Sheet
    • JavaScript Tutorial
    • Html Tutorial
    • Wordpress Tutorial
    • Python Tutorial
    • PHP Tutorial
    • JSP Tutorial
    • AngularJS Tutorial
    • Data Structures
    • E Commerce Tutorial
    • Visual Basic
    • Structs2 Tutorial
    • Digital Electronics
    • Internet Terms
    • Servlet Tutorial
    • Software Engineering
    • Interviews Questions
    • Basic Terms
    • Troubleshooting
Menu

Header Right

Home » C » C Programming

C Program Enter the Student Marks and Find the Percentage and Grade

By Dinesh Thakur

In this example, the if-else-if ladder takes decision based on the value of percentage of marks (percentage) calculated and displays the appropriate division. Here, the value of the percentage calculated for inputted data 80 50 75 evaluates to be 68.33. On the basis of this value, the first condition in if-else-if ladder (percentage>=60 & percentage<100) which evaluates to be true so it displays the message First Division and skip the remaining conditions.

Problem Statement:
Annual exam result is to be conducted for 20 students for 3 subjects. Write a program to read the data and determine the following:

• Collect the exam result data for individual student.
• Calculate all the obtained marks from three subjects for each student.
• Put them in condition statement and get the grading and percentage of students.
• The Student who get clear the required condition for Division placement.

Here is the C program to Find the Percentage or marks of students. This C program is an example to use Control statements.

#include<stdio.h>
void main()
{
         int m1,m2,m3,total;
         float per;
         clrscr();
         printf("Enter 3 Nos.");
         scanf("%D%D%D",&m1,&m2,&m3);
         total=m1+m2+m3;
         per=total*100/300;
         if(per>=60&&per<=100)
                 printf("You are 1st :");
        else if(per>=50&&per<=60)
                 printf("You are 2nd");
        else if(per>=40&&per<=50)
                 printf("You are 3rd");
        else
                 printf("You are Fail");
        getch();
}

Find Percentage and Grade

C Program Enter Age,GenderCode,MaritalStatus Find Driver is Insured or Not

By Dinesh Thakur

 

#include<stdio.h> 
void main()
{
      char gendercode, maritalstatus;
      int age;
      clrscr();
      printf("Enter Age,Gendercode,Maritalstatus : ");
      scanf("%d%c%c",&age,&gendercode,&maritalstatus);
      if(maritalstatus=='m')
             printf("Driver is Insured");
      else
       {
           if(gendercode=='m')
              {
                 if(age>30)
                    printf("driver is insured");
                else
                    printf("driver is not insured");
              }
            else
             {
                   if(age>25)
                      printf("driver is insured");
                   else
                      printf("driver is not insured");
              }
       }
                      getch();
} 

Find Driver is Insured or Not

C Program Program to Calculate the Roots of a Quadratic Equation

By Dinesh Thakur

The roots of a quadratic equation are real if discriminator b2-4ac is greater than or equal to zero; otherwise they are complex conjugate. However, if the roots are complex conjugate, i.e., if b2-4ac<0, the evaluation of expression sqrt (b*b-4*a*c) causes a domain error and the program halts abruptly.

#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
    double a,b,c,d,root1,root2;
    clrscr();
    printf("Enter Value for a : ");
    scanf("%lf", &a);
    printf("Enter Value for b : ");
    scanf("%lf", &b);
    printf("Enter Value for c : ");
    scanf("%lf", &c);
    if (a==0.0)
        {
              printf ("\n a Should NOT be 0");
              exit(0);
        }
             d = b * b - 4 * a * c;
             if ( d > 0.0 )
              {
                   d = sqrt( d );
                   root1 = ( -b + d ) / ( 2 * a );
                   root2 = ( -b - d ) / ( 2 * a );
                   printf("\nThe Roots %.4lf and %.4lf were Found\n\n", root1, root2 );
              }
                   else if ( d == 0.0 )
             {
                   root1 = -b / ( 2 * a );
                   printf("\nA Single Root, %.4lf, was Found\n\n", root1 );
             }
           else
            {
                  printf("\nNo real roots were found\n\n");
            }
                  getch();
} 

Roots of a Quadratic Equation

C Program To Find if the Number is Odd or Even, -Ve or +Ve or Zero

By Dinesh Thakur

In this program user ask to check whether the number is even, odd, -ve, +ve. For this user need to use control statement like if-else. User put the condition if (a==0) then number is zero. if (a%2==0 && a>0) number is even and positive. if (a%2==0 && a<0) number is even and negative or if (a%2!=0 && a>0) number is odd and positive these are some conditions to verify the number pahse. And display result on the screen.

Problem Statement:

This is C program that asks user to check out the number positive, negative or zero.

  1. Declaring variables.
  2. Using control statement.
  3. Display result on the screen.

Here is C source code for checking number phase. The output of this program shown below. 

#include <conio.h> 
void main ()
{
        int a;
        clrscr();
        printf ("\nEnter a Number : ");
        scanf ("%d",&a);
        if (a==0)
             printf ("\n\nThe Entered number is 0");
        if (a%2==0 && a>0)
            printf ("\n\nThe Number is Even and +ve");
        if (a%2==0 && a<0)
            printf ("\n\nThe Number is Even and -ve");
        if (a%2!=0 && a>0)
            printf ("\n\nThe Number is Odd and +ve");
        if (a%2!=0 && a<0)
            printf ("\n\nThe Number is Odd and -ve");
            getch();
}
Output :
Enter a Number : 10
The Number is Even and +ve

Palindrome Program in C

By Dinesh Thakur

Palindrome number in C language: A palindrome number is the same as the reverse number. Some palindrome numbers, for example, are 8, 121, 212, 12321, and -454. We first reverse the palindrome to check whether a number is a palindrome and then compare the number we obtained with the original. The number is a palindrome if both are the same; otherwise, it is not a palindrome string program.  [Read more…] about Palindrome Program in C

C Program Swap Two Number Without using Third Variable

By Dinesh Thakur

In the program integer type variable declare(x,y) which contains the value. To swap the variables we need to declare them with unique values. To swap the variables without using third variable and in this case we also do not use the Temp (temporary) variable. Some operators for manipulation used for swapping the variable.

Problem Statement:
This Program is to swapping the two Variables without using Third variable.

  1. Entering the number.
  2. Using Logic to swap variables.
  3. Display the Output on the screen.

Syntax of Swapping:
x=x+y;
y=x-y;
x=x-y;

Here is source code of the C program Swap two variables without Using third variable. The C program is successfully compiled. The program output is also shown below.

#include<stdio.h>
void main()
{
    int x,y;
    clrscr();
    printf("\nPlease Enter a Number (x):");
    scanf("%d",&x);
    printf("\nPlease Enter a Number (y):");
    scanf("%d",&y);
    printf("\n\nValues Before Swapping\nx=[%d]\ny=[%d]",x,y);
    x=x+y;
    y=x-y;
    x=x-y;
    printf("\n\nValues After Swapping\nx=[%d]\ny=[%d]",x,y);
    getch();
} 

Swap Two Number Without using Third Variable

C Program Write a Program to Averaging Student Exam Scores

By Dinesh Thakur

In this program user will find out the average of students scores. To perform this action the required info and variables are essentials. Like user declare array type variable and float type that will contain the value to be declared. After that user ask to enter the value like subject marks in the end process user add all the scores and divide them all with total subjects to find out the average of students. And to use printing method shown out the result on the screen.

Problem Statement:

  1. Declaring variables.
  2. Collecting info about scores.
  3. Using average finding method.
  4. Display result on the screen.

Here is C source code for finding average of students. The output of this program shown below. 

[Read more…] about C Program Write a Program to Averaging Student Exam Scores

C Program Write a Program to Find the Compound Interest

By Dinesh Thakur

If the amount deposited in a bank (i.e., principal), number of years and interest rate are denoted asp, n and r, respectively, compound interest (compounded annually) as p(1+r/100)n. The program segment given below calculates and prints compound interest on deposit.

The scanf statement reads the amount deposited (p of type float),interest rate (r of type float),number of years (n of type float)

#include <stdio.h>
#include <math.h>
void main( )
{
       float   p, r, n, i,f;
       clrscr();
       printf("P1ease enter a value for the prinipal (P) : " ) ;
       scanf ( "%f", &p);
       printf("P1ease enter a value for the interestrate ( r ) : " ) ;
       scanf ("%f" , & r );
       printf("P1ease enter a value for the number of years (n) : " ) ;
       scanf ( " % f ", n) ; /* calculate i,then f */
       i= r/100;
       f = p * pow((1 + i ) , n ) ;
       printf ( "\nThe  final  value (F) is : %.2f\n", f ) ;
       getch();
}

Find the Compound Interest

C Program Write a program to calculate the area of a C i r c l e

By Dinesh Thakur

This is c program that asks user to find out the Area of a circle. User need to declare the math function header file for calculation along with required variables like radius or area. User asks to enter radius of a circle for find out the area. User then uses the method to find out the area of a circle. Then too display result on the screen as result.

Problem Statement:

This is C program that ask user to find out the area of a circle.

  1. Declare the variables.
  2. Using method for area of circle.
  3. Display result on the screen.

Formula to area of circle.
“pi*r*r” (pi=3.14)

Here is C source code to find out the area of circle. The output of this program shown below. 

 
#include <stdio.h>
main( )
{
float radius, area;
printf ("Radius = ?  “ ) ;
scanf ( "%f" , &radius) ;
area = 3.14159 * radius * radius;
printf ("Area = %f",area) ;
}

 

C Program How Convert Lowercase to Uppercase Character

By Dinesh Thakur

In this program user ask to convert all the lower case character into uppercase. For this user declare two variable named lower and upper. Here in the program user ask to enter the character for converting. Then user use the method to convert like puts the lower variable into getchar() condition whenever it gets character it will turn into uppercase and then trespass the value to upper variable and print them in the end with printing method.

Problem statement:

This is C program that asks the user to covert the lower case character into upper case.

  1. Declaring the variables.
  2. Using conversion method.
  3. Display result on the screen.

Here is C source code for Converting the Character into Uppercase from lowercase. The output of this program shown below. 

#include <stdio.h> 
#include <ctype.h>
void main ( )
{
       int lower, upper;
       clrscr();
       printf("Enter a Lower Character to Convert Uppercase : ");
       lower = getchar();
       upper = toupper(lower);
       putchar(upper);
       getch();
}
Output :

C Program Write a Program with Pow() Function

By Dinesh Thakur

The function call pow(a, b) is used to evaluate ab, The pow function gives a domain error if the value of a is zero and b is less than or equal to zero or if a is negative and b is not an integer.

#include <stdio.h>
#include <math.h>
main()
{
double a= 2.0;
double b= 3.0;
printf("%f^%f=%f",a,b,pow(a,b));
}

C Program Write a Program to Check the Size of Int

By Dinesh Thakur

This is C program that asks user to find out the size of int. there are too many data types in programming languages. All are same in using like any content acquired the memory as well as data types also acquire the memory like char, integer, float or double etc. integer data type acquire the 2 bytes. This is the program that uses to define the data type memory acquiring status. Using some methods to find out the display as result.

Problem Statement.
This is C program that ask user to find out the memory or size of integer.

  1. Declare the variables.
  2. Using memory.
  3. Display result on the screen.

Here is C source code to find out the size of int. The output of this program shown below.

            void main()
            {
               printf("%d \n", sizeof(int));
        }

C Program Write a Program with SizeOf with Struct

By Dinesh Thakur

The function sizeof () gives the number of bytes allocated to store the argument of the function. For example, sizeof (x) will give the numbers of bytes allocated for storing x. Similarly, sizeof (int) will give number of bytes allocated for storing an int number. The number of bytes allocated for a particular data type depends on the computer system, the operating system, and the compiler used.


void main()

 {
     struct
      {
          int a;
          int b;
      } TInts;
      clrscr();
      printf("The Size of a & b is = %d \n", sizeof(TInts));
 }

C Program Find Out the Size of the Different Data Types

By Dinesh Thakur

This is C program that asks user to define the size of data types acquired by them. Data types are known as those elements that tells the user which kind of data elements they have for example integer type for numeric value, char type for characters. All the data types have their limits for numerical expressions like char is 0-255 bits.

In this program user to define the size of data types. User declares a variable int i for storing or contain the value that will be imprinted as result on the screen. All the data types are printed through the print method. User also declares a method to fetch out the size of data types.
Problem Statement:
This is C program example to fetch out the size of data types.

  1. Declare variable.
  2. Define method to fetch out data type size.
  3. Display result on the screen.

Here is C source code for fetching out the data types size. Output of this program shown below. 

#include <stdio.h>
void main()
{                                                       
  int i;
  clrscr();
  printf("    short int is %2d bytes \n", sizeof(short int));
  printf("          int is %2d bytes \n", sizeof(int));
  printf("        int * is %2d bytes \n", sizeof(int *));
  printf("     long int is %2d bytes \n", sizeof(long int));
  printf("   long int * is %2d bytes \n", sizeof(long int *));
  printf("   signed int is %2d bytes \n", sizeof(signed int));
  printf(" unsigned int is %2d bytes \n", sizeof(unsigned int));
  printf("\n");
  printf("        float is %2d bytes \n", sizeof(float));
  printf("      float * is %2d bytes \n", sizeof(float *));
  printf("       double is %2d bytes \n", sizeof(double));
  printf("     double * is %2d bytes \n", sizeof(double *));
  printf("  long double is %2d bytes \n", sizeof(long double));
  printf("\n");
  printf("  signed char is %2d bytes \n", sizeof(signed char));
  printf("         char is %2d bytes \n", sizeof(char));
  printf("       char * is %2d bytes \n", sizeof(char *));
  printf("unsigned char is %2d bytes \n", sizeof(unsigned char));
  getch();
} 

Find Out the Size of the Different Data Types

C Program How to Print the Menu Screen

By Dinesh Thakur

This is C program that asks user to print a menu screen on display. For this user declare some variables to storing the value in it. Here user uses currency converter method for menu screen. User only prints the message to currency conversion. And some new line tag or space tag used for space ad new line composition. printing the quoted message on the screen as the result.

Problem statement:

This is C Program that asks user to print the menu screen on the display.

  1. Declaring variables.
  2. Using print method.
  3. Display result on the screen.

Here is C source code for printing the menu screen. Output of this program shown below. 

#include<stdio.h> 
#include<stdlib.h>
void menu()
{
            /*print menu screen*/
            clrscr();
            printf("\t\t\t***********************************\n");
            printf("\t\t\t** WELCOME TO CURRENCY CONVERTER **\n");
            printf("\t\t\t***********************************\n");
            printf("\t\t\t             DINESH THAKUR \n");
            printf("\t\t\t***********************************\n");
            printf("\t\t\t\t\tMENU\n\n\n");
            printf("\t\t\t\t1-$US to EURO\n");
            printf("\t\t\t\t2-$US to SWISS FRANC\n");
            printf("\t\t\t\t3-$US to YEN\n");
            printf("\t\t\t\t4-$US to BRITISH POUND\n");
            printf("\t\t\t\t5-EURO to $US\n");
            printf("\t\t\t\t6-SWISS FRANC to $US\n");
            printf("\t\t\t\t7-YEN to $US\n");
            printf("\t\t\t\t8-BRITISH POUND to $US\n");
            printf("\t\t\t\tE-to exit at any time.\n\n\n");
            printf("\t\t\t***********************************\n\n\n");
            getch();
} 

Print the Menu Screen

C Program Write a Program to Swap a Two Number

By Dinesh Thakur

In this program the two numbers to be swapped from each other place with the use of third variable. In program the variables declare for storing the value in it. Here three variables are also declared (a,b,c) the use of only two numbers the swapping will happen. The first number shifted to third variable and then to other variable the reverse phase will be on the move to swap both numbers. And other functionality also comes in light for displaying the result on the screen.

Problem Statement:
This is C Program to Swap Two Numbers Using Third variable.

  1. Declaring variable.
  2. Using swap condition.
  3. Display result on the screen.

Here is source code of the C program to Swap a Two Number. The C program is successfully compiled. The program output is also shown below. 

#include<stdio.h>
main()
{
int a,b,c;
clrscr();
printf("enter the two value");
scanf("%d%d",&a,&b);
c=a;
a=b;
b=c;
printf("%d\n%d",a,b);
getch();
}
 Swap a Two Number

C Program Write a Programe with Bitwise Operator and: C1 & C2

By Dinesh Thakur

 This is C Program for define the Bitwise operator. Binary system operator known as bitwise operator like Left shift or right shift operator. The operands value is moved left or right by the number of bits specified by the operand position right or left. To define this condition user declares the variables c1, c2, c3. Here user define char type variables and define the value as static mode manually. User put the condition to define bitwise operator c3 = c1 & c2. And display output as result on the screen.

Problem Statement:

This is C program that asks user to define bitwise operator.

  1. Declare variables.
  2. Using define method.
  3. Display output on the screen as result.

Here is C source code for Define the Bitwise operator. Output of this program shown below.

# include<stdio.h> 
void main()
{
    int c1 = 4,c2 = 6,c3 = 0;
    clrscr();
    c3 = c1 & c2;
    printf("\n Bitwise AND i.e. c1 & c2 = %d",c3);
    getch(); 
}

Program with Bitwise Operator

C Program Write a Program to Convert a Char to ASCII Value

By Dinesh Thakur

This is the C program for converting a character into ASCII value.

In this Program User ask to convert a Character to ASCII value. Formal Char type Variable Declared for containing and computing the value. With use of scanf() user ask the value to run time position. With the use of (%u) unsigned-int used as Pointers (when treated as numbers) will fetch the result.
Problem Statement:

  1. This is the program to convert the Character value Into ASCII Format.
  2. Entering the Value.
  3. Display the result on Screen.

Here is source code of the C program to convert the Character value Into ASCII Format. The C program is successfully compiled. The program output is also shown below.

#include<stdio.h> 
void main()
{
     char a;
     clrscr();
     printf("Enter the Character : ");
     scanf("%c",&a);
     printf("The ASCII Code is : %u",a,a);
     getch();
}
Output :
Enter the Character : a
The ASCII Code is : 97

C Program Write a Program with Bitwise or: C1 | C2

By Dinesh Thakur

 

 


# include<stdio.h>
main()
{
  char c1 = 4,c2 =6 ,c3 = 3;
  c3 = c1 | c2;
  printf("\n Bitwise OR i.e. c1 | c2 = %c",c3);
}

C Program Write a Program with Bitwise XOR: C1 ^ C2

By Dinesh Thakur

This is C program that ask user to define the Bitwise XOR operator. This operator in C compares each bit of its first operand to the corresponding bit of its second operand. If one bit is 0 and the other bit is 1, the result will bit is set to 1 Otherwise 0.

User declares char type variables for this operation with static value manually. User put method to find out the result c3 = c1 ^ c2. The sign between operands is known as equivalent for bits. And display result on the screen as output.

Problem Statement:

This is C program that asks user to define the XOR operator in C.

  1. Declare variables.
  2. Using method for calculation.
  3. Display result on the screen.

Here is C source code for defining the XOR operator. Output of this program shown below.

# include<stdio.h>
void main()
{
  int c1 = 4,c2 = 6,c3 = 0;
  c3 = c1 ^ c2;
  printf("\n Bitwise XOR i.e. c1 ^ c2 = %d",c3);
}

C Program Write a Program with Complement

By Dinesh Thakur

[Read more…] about C Program Write a Program with Complement

C Program Write a Program with Left Shift Operator

By Dinesh Thakur

In this program user ask to define the left shift operator. Left Shift Operator The left operands value is moved left by the number of bits specified by the right operand. User declares required variables for storing the value. User put a condition to shift the bits from right to left c3 = c1<<2. Display result on the screen.

Problem Statement:
This is C Program that ask user to define a left shift operator with use of Logic.

  1. Declare variable.
  2. Using Method.
  3. Display result on the Screen.

Here is C source code for define the left shift bit wise operator. Output of this program shown below.

# include<stdio.h>
void main()
{
    int c1 = 1,c3 = 3;
    clrscr();
    c3 = c1<<2;
    printf("\nLeft Shift by 2 Bits c1 << 2 = %d",c3);
    getch();
}
Left Shift Operator

C Program Write a Program with Right Shift Operation

By Dinesh Thakur

[Read more…] about C Program Write a Program with Right Shift Operation

C Program A Special Feature of the >> and ision and Multiplication

By Dinesh Thakur

 

 

#include <stdio.h>
int main(){
   int x, y = 6;
   x = y >> 1;
 
   printf("%d",x);
   x = y/2;
 
   printf("%d",x);
}
 

C Program Write a Programe with Bitwise To Divide Value by 4

By Dinesh Thakur

 

 

#include <stdio.h>
int main(){
   int x, y = 8;
   x = y >> 2;
 
   printf("%d",x);
   x = y/4;
 
   printf("%d",x);
}
 

C Program Write a Program to Calculate Interest of Value

By Dinesh Thakur

This is c program that ask user to find out the interest of value. Here user declares the variables for containing the value in it. User has all components to find out the interest of value. User asks to enter the number for program execution and use the method of Simple interest. Display the result on the screen as output.

Problem Statement:

This is c program that ask to find out the simple interest.

  1. Declare the variables.
  2. Using S.I method.
  3. Display result on the screen.

Syntax of Simple interest method:
“si =p*r*t/100; “

Here is C source code to find out the Simple interest. Output of this program shown below. 


#include<stdio.h>
main()
{
int p,r,t,si;
clrscr();
printf("enter the p,r,t");
scanf("%d%d%d",&p,&r,&t);
si=p*r*t/100;
printf("%d",si);
getch();
}
 

C Program Sum Total of Five Subject and Calculate Average and Percentage

By Dinesh Thakur

In this program integer type variables are created which contained data of five subjects that are given. Then some variables of floating type data type also created for required data containing decimal values from user.

Problem Statement:
In the program five subjects are contained to deduct average and total marks. Write a program to read the data and determine the following:

  1. Collect the Data for each subject.
  2. Calculate the sum of all subjects.
  3. Using the formula for Sum of subject and Calculating the Average.
  4. Display the result that comes as output in the end.

That is source code of the C program to find the Sum and calculate the Average and percentage of Five subjects. The control statement is used in this code for executing the condition.

void main() 
{
          int a,b,c,d,e;
          float f,g,h;
          clrscr();
          printf("Enter the Marks Subject maths = ");
          scanf("%d",&a);
          printf("Enter the Marks Subject hindi = ");
          scanf("%d",&b);
          printf("Enter the Marks Subject punjabi = ");
          scanf("%d",&c);
          printf("Enter the Marks Subject english = ");
          scanf("%d",&d);
          printf("Enter the Marks Subject science = ");
          scanf("%d",&e);
          f=a+b+c+d+e;
          g=f/5;
          h=(f/500)*100;
          printf("\nTotal Marks = %f ",f);
          printf("\nAverage Marks = %f",g);
          printf("\nPercentage Marks = %f %",h);
          getch();
}

Calculate Average and Percentage

 

C Program Write Program to Calculate the Quadric Equation

By Dinesh Thakur

This is C program that ask to find out the quadric equation. User need to declare the variables that can contain the value in it. Here user asks to enter the value for each variable declared in the equation. User asks value on run time situation. Core step of this program to define the quadric method for equation execution. As user put on the method the result is on display as output.

Problem Statement:

This is C program that asks user to find out the quadric equation.

  1. Declare the variables.
  2. Using quadric method.
  3. Display result on the screen as output.

Syntax of Quadric method:
” d=((b*b)-(4*a*c))/(2*a); “

Here is C source code to find out the quadric equation. The output of this program shown below. 

void main()
{
float a,b,c,d;
clrscr();
printf("enter the value of a=  ");
scanf("%f",&a);
printf("enter the value of b=  ");
scanf("%f",&b);
printf("enter the value of c=  ");
scanf("%f",&c);
d=((b*b)-(4*a*c))/(2*a);
printf("\nroots of quadratic eq.=  %f",d);
getch();
}
 Calculate the Quadric Equation

C Program Write a Program to Calculate Fahrenheit to Celsius

By Dinesh Thakur

 

 

#include<stdio.h> 
main()
{
float fearn,cel;
printf("Enter the Temperature in Fahrenheit =");
scanf("%f",&fearn);
cel=(fearn-32)*5/9;
printf ("Temperature in Celsius is =%f",cel);
getch();
}
 Calculate Fahrenheit to Celsius

C Program Calculate Basic Salary and Grow Salary of a Employee

By Dinesh Thakur

In this program user ask to calculate the gross salary of employees. To calculate the gross salary all the facts in salary like da,hra,basic salary also included. The addition of all salary element show out the gross salary chart.

In this program user declare the float type variables to store the content or value. After entering the basic salary user ask to find the hra, da with manipulation to basic salary with required conditions.. After calculating the elements add them all to find the gross salary. In the last to print out the gross salary chart on screen.
Problem Statement:
This is C program to calculate the gross salary of organizational employees.

  1. Declaring the variable.
  2. Finding the Hra, Da of an employee.
  3. Calculate the gross salary.
  4. Display the result on the screen.

Here is C source code for calculating the gross salary of employees. The output of this program shown below.

#include<stdio.h>
void main()
{
        float da,hra,bs,gs;
        clrscr();
        printf("Enter the Basic Salary : ");
        scanf("%f",&bs);
        da=(40*bs)/100;
        hra=(20*bs)/100;
        gs=da+hra+bs;
        printf("The Gross Salary is : %f",gs);
        getch();
}
Output :

 

« Previous Page
Next Page »

Primary Sidebar

C Programming

C Programming Tutorials

  • C - History
  • C - Anatomy
  • C - Constants
  • C - Identifiers
  • C - Data Types
  • C - Libraries File
  • C - Header Files
  • C - Basic Language
  • C - Data Types Sizes
  • C - Header Files Importance
  • C - Escape Sequences
  • C - Main() Purpose
  • C - Program Procedure
  • C - Control Statements
  • C - Enumeration Constant
  • C - Add numbers
  • C - Return Statement
  • C - Avoid Goto
  • C - Command Line Arguments
  • C - Switch Case
  • C - Switch Case Limitations
  • C - getchar() and putchar()
  • C - Iteration Statements
  • C - Pass by Value and Reference
  • C - Structures and Unions
  • C - Structure
  • C - Dynamic Memory
  • C - Fgets and Fputs Functions
  • C - Gets() and Puts() Functions
  • C - Armstrong Number
  • C - Storage Classes
  • C - Fibonacci Series
  • C - Precision Setting
  • C - const Parameters

C - Variable & It's Type

  • C - Variables
  • C - Variable Lifetime
  • C - Static Variable
  • C - Register Variable
  • C - Global Variables
  • C - Auto Variables
  • C - Local Variables

C - Operator & Expressions

  • C - Operator
  • C - Boolean Operators
  • C - Bitwise Operator
  • C - Arithmetic Operators
  • C - Modulus Operator
  • C - Ternary Operator
  • C - Expressions
  • C - Arithmetic Expressions

C - Array

  • C - Arrays
  • C - Array Types
  • C - Array Characteristics
  • C - Static Arrays
  • C - Global Arrays
  • C - 3D Arrays
  • C - Dynamic Arrays
  • C - Pointer to 3D Arrays
  • C - Array Elements Hold
  • C - Arrays as Function Parameters
  • C - Accessing Matrix Elements
  • C - File Handling
  • C - Matrix Multiplication
  • C - Dynamic Memory Allocation

C - Searching & Sorting

  • C - Data Structures
  • C - Linear Search
  • C - Bubble Sort
  • C - Merge Sort
  • C - Linked List
  • C - Insertion Sort
  • C - Binary Search
  • C - Selection Sort
  • C - Quick Sort

C - Functions

  • C - Functions
  • C - Functions Advantages
  • C - Void Functions
  • C - Function Call
  • C - Default Return Value
  • C - String functions

C - Pointer

  • C - Pointers
  • C - Type Casting Of Pointers
  • C - Pointer Advantages
  • C - Pointers Initialization
  • C - Vectors and Pointers

C - Differences

  • C - C Vs C++
  • C - Formal Args. Vs Actual Args.
  • C - Keywords Vs Identifiers
  • C - Strings Vs Character Arrays
  • C - Address Vs Dereference Operator
  • C - Goto Vs longjmp
  • C - Declaring Vs Defining Variable
  • C - String Vs Array
  • C - Call by Value Vs Reference
  • C - Structure Vs Union
  • C - For Vs While loops
  • C - Compiler Vs Interpreter

C - Programs

  • C Program Standard Deviation
  • C Program Calculate Tax
  • C Program Sum Series
  • C Program Merge Arrays
  • C Program Euclid’s Algorithm
  • C Program Print Weekdays
  • C Program Sum of Digits
  • C Program Print a list
  • C Program Print Pythagorean
  • C Program Quiz program
  • C Program Display Table
  • C Program Print Comma-Separated
  • C Program Prints Prime Numbers
  • C Program for Print Integer
  • C Program Count Number
  • C Program Print Color Name
  • C Program Print Odd Numbers
  • C Program Calculate area
  • C Program for a Menu
  • C Program Add Two Vectors
  • C Program Array Addresses
  • C Program Division by Zero Error
  • C Program Compare two Dates
  • C Program Tower of Hanoi
  • C Program return 3 Numbers
  • C Program for Prime Numbers
  • C Program for Factorial
  • C Program for Palindrome

Other Links

  • C Programming - PDF Version

Footer

Basic Course

  • Computer Fundamental
  • Computer Networking
  • Operating System
  • Database System
  • Computer Graphics
  • Management System
  • Software Engineering
  • Digital Electronics
  • Electronic Commerce
  • Compiler Design
  • Troubleshooting

Programming

  • Java Programming
  • Structured Query (SQL)
  • C Programming
  • C++ Programming
  • Visual Basic
  • Data Structures
  • Struts 2
  • Java Servlet
  • C# Programming
  • Basic Terms
  • Interviews

World Wide Web

  • Internet
  • Java Script
  • HTML Language
  • Cascading Style Sheet
  • Java Server Pages
  • Wordpress
  • PHP
  • Python Tutorial
  • AngularJS
  • Troubleshooting

 About Us |  Contact Us |  FAQ

Dinesh Thakur is a Technology Columinist and founder of Computer Notes.

Copyright © 2025. All Rights Reserved.

APPLY FOR ONLINE JOB IN BIGGEST CRYPTO COMPANIES
APPLY NOW