School fee management program using C language

 In this I will let you know how to write a program that manage school without using any complication . So , without wasting our let's get started .  First I show you code then we come to explanation .

Code:

#include <stdio.h>
//School fees management program using C languag

int main()
{
    //For Students Details
    char SchoolName[30];//School Name
    char Date[10];//To get date 
    int Eno;        //Student Enrollement
    char Sname[20]; //Student Name
    char Fname[20]; //Student's Father's Name
    char Mname[20]; //Student's Mother's Name
    char C_S[10];   //Class and Section
    //Now for fees details
    int CMF; //Consoliated Monthly fees
    int R_f; //Readmission and fine
    int Conveyance;//If you use bus 
    int Tfess;//Term fees 
    int Cfess;//Computer fees
    int Exam;//Exam fees
    int Rfess;//Registration fees
    int Afess;//Admission fees 
    int concession;//Concession fees 
    int grTotal;//grand Total
    printf("Enrollenment no.\n");
    scanf("%d",&Eno);
    printf("School name\n");
    scanf(%[^\n]s",SchoolName);
    printf("Date\n");
    scanf(%[^\n]s",Date);
    printf("Student name\n");
    scanf(%[^\n]s",Sname);
    printf("Father's Name\n");
    scanf(%[^\n]s",Fname);
    printf("Mother's Name\n");
    scanf(%[^\n]s",Mname);
    printf("Class & section\n");
    scanf(%[^\n]s",C_S);
    printf("Consilated Monthly Fees:\n");
    scanf("%d",&CMF);
    printf("Readmission/Fine: \n");
    scanf("%d",&R_f);
    printf("Conveyance: \n");
    scanf("%d",&Conveyance);
    printf("Term Fees: \n");
    scanf("%d",&Tfess);
    printf("Computer fees: \n");
    scanf("%d",&Cfess);
    printf("Exam fees: \n");
    scanf("%d",&Exam);
    printf("Registration Fees: \n");
    scanf("%d",&Rfess);
    printf("Admission Fees :\n");
    scanf("%d",&Afess);
    printf("Concession: \n");
    scanf("%d",&concession);
    grTotal=(CMF+R_f+Conveyance+Tfess+Cfess+Exam+Rfess+Afess)-(concession);
    //Grandtotal is sum of all subract concession 
     printf("Date:%s     School Name :%s\n",Date,SchoolName);
     printf("Enrollement No.%d         Student Name:%s   Class & Section: %s\n",Eno,Sname,C_S);
     printf("Father's Name:%s            Mother's Name:%s\n",Fname,Mname);
     printf("------------------------------------------------------------------------------\n");
     printf("Consilated Monthly Fees : %d\t\t Readmission/fine :%d\n",CMF,R_f);
     printf("Conveyance fees :%d\t\t Term Fees : %d\n ",Conveyance,Tfess);
     printf("Computer fees : %d \t\t Exam fees :%d\n",Cfess,Exam);
     printf("Registration fees : %d \t \t Admission fees :%d\n ",Rfess,Afess);
     printf("Concession : %d\n");
     printf("----------------------------------------------------------------------------------\n");
     printf("Grand Total : %d \n",grTotal);

    return 0;
}

Logic:

Here we first declare  the variables for the details of the students . Namely SchoolName , Date, Sname(Student's Name), Fname(father's Name), Mname(mother's Name), C_S(class & section)  of type character array(String) and  Eno(Enrollement No) of type int. And then we  define variables for fees details of the students . I just define variables for only few important fees details you can customize it according to yours . Here two important variables is necessary that is grTotal(grand Total) of fees and Concession . And then we take input to these variables for int data type taking input is easy . And for String  we take input using special method  About input in String . And then we do grandTotal of fees by adding other charges  and subtract concession from it . And then we just use printf statement and to show user  fees summary of student.

Output:


here you can see that we give input as required . And then we get our desired output . This tells us that our program work properly. Try this by self by changing the variables . Please provide feedback  this code by commenting  your views.  I hope this is helpful in your work . Thanks for reading.



C program to count number of lowercase and Upper case letters in String

 In this post I will tell you how to make a program that count number of uppercase letters and lowercase letters in a string  Know about counting integers . So, without any further delay let's started.

Code:

#include<stdio.h>
#include<string.h>

void numberLetter(char s[]){
    int i=0;
    int j=0;
    int k=0;
    while(i<strlen(s)){
      if(s[i]>=65 && s[i]<=90){
             j++;
      }
      else if(s[i]>=97 && s[i]<=122){
          k++;
      }
      i++;
    }
    printf("Number of Upper case letters : %d\n",j);
    printf("Number of Lower case letters : %d\n",k);
}
int main(){
char str[100];
printf("Enter any String \n");
scanf(%[^\n]s",str);//take the input till user press enter 
numberLetter(str);
    return 0;
}

Logic:

Here first we declare a String of name str[100] that will take up to hundred characters. Then we use printf statement to said user to enter string . And using scanf we take input . And you see I give some space between  double quote and % because we are telling compiler that only read string not white space.  Here we ^\n use this operator to tell compiler take input till user press Enter. Then we define a function called numberLetter which take string as its arguments. And in that we define three variable of int i , j ,k and initialize it from 0 . Then we run a while loop till the length given of string and we gets its length using strlen() function and that is why we include string.h our header file .  Then we use if condition and check each character of string between  and equal to 65 and 90 . Because they are their Ascii value . If this condition is true then j++  increase value of j. And for lower case we check between and equal to 97 and 122. And if this condition is true then k++ will increase value of k. Then we give i++ which will get in work till our loop condition. And value of j and every time when condition is true.  And in end we use printf to print the output . Know about basic C. Then we call numberLetter function in main and give str as parameter. 

Output:


You see that it works very well as we think according to logic and code. You must try this by yourself and become better programmer . I hope that you find this helpful in your work .                                     Thanks for reading.


C language to print count 0 to 10

 In this  I will tell you how to write a program in which we can count number of zeros, number of positive integers , number of negative integers . So without any further delay let's get started . First I will show you code then we come to explanation.

Code:

#include <stdio.h>
//Counting numbers from 0 to 10
int main()
{
    int n1 = 0;
    int n2 = 0;
    int n3 = 0;
    for (int i = 0; i <=10; i++)
    {if(i==0){//condition for zeros 
        n1++;
    }
    else if(i>=0){//Condition for postive integers 
        n2++;
    }
    else if(i<=0){//Condition for negative integers 
        n3++;
    }
    }
    printf("Number of zeros : %d\n",n1);
    printf("Number of positive integers : %d\n",n2);
    printf("Number of Negative integers : %d\n",n3);

    return 0;
}

Logic :

The logic here is very simple . Here we first three integer n1 , n2 , n3 and initialize it from zero .Then we open a for loop and start it from 0 and till 10 . You can also do it without other loops. And then we use if condition for zero if  true then value of n1++(increase by one ). Then we come to next condition of else if  for positive integers if true then n2++(increase by one). Then we come to negative integers if true then n3++(increase by one ). And in end we use printf and print number of zeros ,then positive integers and then negative integers . 

Output:


You can see as we run loop till 10 that why here we have 1 zero , 10 positive integers because we start from 0 . No negative integers  you must try this on your pc . And you can also run this loop till user given number by changing condition of loop . 

                                              I hope that you find this helpful in your work .

                                                             Thanks for reading .