Friday, March 18, 2016

C program to print even numbers between given two numbers.

Write a C program print even numbers between given two numbers.

This C program prints the even number between the two number supplied by user

C Program source code

#include<stdio.h>
#include<conio.h>
int main()
{
 int i,n1,n2;
 printf("Enter any two numbers:\n");
 scanf("%d%d",&n1,&n2);
 for(i=n1;i<=n2;i++)
 {
  if(i%2==0)
  {
   printf("%d\t",i);
  }
 }
 printf("\nThese are the even numbers between those two numbers.");
 getch();
 return(0);
}

You can Browse related article below for more information and program code related to different math operation.  Does above is helpful , Post you views in comment

DO NOT MISS OTHER C PROGRAMMING TUTORIAL

* indicates required



C program to print even numbers between given two numbers.

Wednesday, March 16, 2016

Structure Learning for both novices and advanced programmers

Structure

The meaning of structure is the quality of being organized in general term. To understand the structure in programming language you must be able to link it with general meaning
  • 1) How can we link it with general meaning?
  • 2) What is structure in c?
In programming structure is the collection of various data of different data type. We can connect it with the class of java or other OOP language. As class has object which have property and method, But here we have an object and its property or value.

Structure helps to bring real physical object into virtual computer world.

A simple structure can be
Student with property 1) Name 2) Roll number 3) Age etc.
Structure

  • 1) How structure is different from array and variable?

  • 2) What is advantage of structure?
Structure is used for data handling operation.
It can be good to think that there are already other syntax that can handle data, then why is the need of Structure.


The main advantage of structure is that it can group different types of logically related data .

For example if you want to create a record of a person that contains name, age and height of that person, then we can’t use array because all the three data elements are of different data types.

To store these related fields of different data types we can use a structure, which is capable of storing heterogeneous data.

Data of different types can be grouped together under a single name using structure.

The data elements of a structure are referred to as member (property)

You can Browse related article below for more information and program code related to Structure  Does above is helpful , Post you views in comment

DO NOT MISS OTHER C PROGRAMMING TUTORIAL

* indicates required


Structure Learning for both novices and advanced programmers


Wednesday, March 9, 2016

C Programming Quiz online on input and output

Following quiz provides Multiple Choice Questions (MCQs) related to C Programming input and output . You will have to read all the given answers and click over the correct answer. You are given 3 to 4 options , you have to click on option  until you are right.
c programming quiz on input and output
c programming quiz on input and output

1.What is difference between getch() and getche()?





2.scanf("%3f%4f",&x,&y);
Input is: 5.93 , 65.87





3.What is use of escape character '\b'?





4.What is use of escape character '\r'?





5.What is use of escape character '\a'?





6.'\v' and '\f' escape character are effective for?





7.scanf("%d%*c%d%*c%d",&x,&y,&z);
Input is: 3/1/2003





8.printf("%8.3s","sureshkumar");





9.printf("9\\11\\1978");





10.printf("%7.3f","100.4567");




You can Browse related article below for more information and program code related to string function

 Does above is helpful , Post you views in comment

DO NOT MISS OTHER C PROGRAMMING TUTORIAL

* indicates required


Fibonacci series using recursive function

Write a program using recursive to read positive number  and determine the fibonacci series of n terms

C Program source code

#include<stdio.h>
#include<conio.h>
int fibbo(int n1, int n2);
int n ,no=1 ,temp;
int main ()
{   int n1=0,n2=1;
    printf("Enter number of terms in fibbonaccic series:");
    scanf("%d",&n);
    printf("\n");
 printf("fibbonaccic series of %d term are  :\n" , n);
 printf("%d\t",n1);
 printf("%d\t",n2);
 fibbo(n1,n2);
 getch();
 return 0 ;
}
int fibbo(int n1 , int n2)
{
 if(no==n-1)
 return 0;
 temp = n1;
 n1=n2;
 n2 =n1+ temp;
 printf("%d\t",n2);
 no++;
 fibbo(n1,n2);
 
}


You can Browse related article below for more information and program code related to string function

 Does above is helpful , Post you views in comment

DO NOT MISS OTHER C PROGRAMMING TUTORIAL

* indicates required


Fibonacci series using recursive function

Multidimensional array in c

A multinational company has hired 3 sales persons for marketing/selling its 3 different products in Kathmandu .Each sales person sells each of these products. Write a c program to read number of each product sold by all sales-persons. Calculate total sells of each item and the total sells of each sales-person . Use array

C Program source code

#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
 int pro[3][3],sum=0;
 int j ,i  ;
 char per[3][10]={ "first","second","third"};
 for (i=0 ; i<3 ; i++)
 {
  for(j=0 ; j<3 ; j++)
  {
      
    printf("enter number of selling of %s person %s product:" , per[i] ,per[j] );
    scanf("%d", &pro[i][j]);
       printf("\n");

  }
 }
 

  for (i=0 ; i<3 ; i++)
 { 
  for(j=0 ; j<3 ; j++)
  {
   
   sum = sum + pro[j][i];
   
  }
 printf("Total sell of %s item is:%d\n",per[i], sum);
 sum=0; 
   }
   for (i=0 ; i<3 ; i++)
 { 
  for(j=0 ; j<3 ; j++)
  {
   
   sum = sum + pro[i][j];
   
  }
 printf("Total sell of %s person is:%d\n",per[i], sum);
 sum=0; 
   } 
getch();
return(0); 
}



You can Browse related article below for more information and program code related to string function

 Does above is helpful , Post you views in comment

DO NOT MISS OTHER C PROGRAMMING TUTORIAL

* indicates required


Multidimensional array in c

Print pattern in c - star pattern-5

print star pattern in C language

Print pattern in c - star pattern


Write a program to print following pattern

   * 
  ** 
 *** 
****

Program code

#include<stdio.h>
int main()
{
    int rows,i,j,space;
    printf("Enter number of rows: ");
    scanf("%d",&rows);
    for(i=rows;i>=1;--i)
    {
        for(space=0;space<rows-i;++space)
           printf("  ");
        for(j=i;j<=2*i-1;++j)
          printf("* ");
        for(j=0;j<i-1;++j)
            printf("* ");
        printf("\n");
    }
    return 0;
}

You can Browse related article below for more information and program code related to recursive function call

 Does above is helpful , Post you views in comment

DO NOT MISS OTHER C PROGRAMMING TUTORIAL

* indicates required






C program source code to print reversed string using string function

C program source code to print reversed string using string function


Write a C program  to print reversed string using string function

C Program source code

#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char name[100];
printf("Enter any character:");
gets(name);
strrev(name);
printf("The character after reversing is:");
puts(name);
getch();
return 0;
}




You can Browse related article below for more information and program code related to string function

 Does above is helpful , Post you views in comment

DO NOT MISS OTHER C PROGRAMMING TUTORIAL

* indicates required