Thursday, May 16, 2013

c programming for mathematical calculations....


-->


  1) How to convert a decimal integer to hexadecimal?








#include<stdio.h>
main()
{
int a;
scanf("%d",&a);
printf("%x",a);
}

This program converts a decimal integer to hexadecimal integer.
To convert hexadecimal integer to decimal integer by replacing %d by %x and %x by %b.

#include<stdio.h>
main()
{
int a;
scanf("%x",&a);
printf("%d",a);
}







 2) Write a program to find sum of digit of a number ?




#include<stdio.h>
main()
{
int n,i,j,sum=0;
printf("enter a number:");
scanf("%d",&n);
printf("sum of digits of %d is \n",n);
while(n)
{
i=n;
j=i%10;
n=i/10;
sum=sum+j;
}
printf("%d \n",sum);
}







 3) Write a c program to check a number prime or not?




#include<stdio.h>
main()
{
int a,b,count=0;
printf("enter no:");
scanf("%d",&b);
for(a=2;a<b;a++)
{
if(b%a==0)
{
count++;
break;
}
}
if(count==0)
{
printf("prime \n");
}
else
{
printf("not prime \n");
}
}









4) Write a c program to find the LCM & HCF of two given numbers?





#include<stdio.h>
main()
{
int n1,n2,d,lcm,hcf,r,product;
printf("enter two numbers:");
scanf("%d%d",&n1,&n2);
product=n1*n2;
while(n1!=n2)
{
if(n1>n2)
n1=n1-n2;
else
n2=n2-n1;
}
hcf=n1;
lcm=product/hcf;
printf("HCF: %d",hcf);
printf("\nLCM: %d",lcm);
}








5) Write a c program to list Fibonacci Series up to n terms?





#include<stdio.h>
main()
{
int a=1,b=0,c=0,n;
printf("enter the number:");
scanf("%d",&n);
while(c<=n)
{
printf("%d \n",c);
c=a+b;
a=b;
b=c;
}
}




 Algorithm for fibonacci series

1)Declare all variables a=1,b=0,c=0 &n.
   (because, first two numbers are 0 & 2)
2)store input(a integer value) to a variable.
3)Answer-----0 1 1 2 3 5 8
  so, current number should be sum of two previous numbers.
  c=a+b;
  a=b;
  This command is used to store previous value of
  b to a.
  b=c;
  This command is used to store previous value of
  c to a.





Let's start c programming...


-->









Start with a simple program to print a "Hello World" message on screen and i will tell what does the commands in it.

#include<stdio.h>

main()

{

 printf("Hello World \n");

}

#include<stdio.h>

C programs are divided into modules or functions. Library functions are grouped category-wise and stored in different files known as header files. It is necessary to tell the compiler about the files to be accessed for accessing it.

#include<name>

#include<stdio.h>  includes the files that performs standard input output operations.

main()

main is a part of all C program.

printf("Hello World \n")

printf command for printing output into screen.



  A simple program to understand function of #define..



#include<stdio.h>
#define N 10
main()
{
int count;
float sum,average,number;
sum=0;
count=0;
while(count<N)
{
scanf("%f",&number);
sum=sum+number;
count=count+1;
}
average=sum/N;
printf("N=%d Sum=%f",N,sum);
printf("Average=%f",average);
}

In above program N is taken as a constant value.
Here N=10. When "average=sum/N;" loads value of N loaded from "#define N 10".




 Program to understand scanf function...






#include<stdio.h>
main()
{
int a;
scanf("%d",&a);
printf("%d",a);
}


Above program will show you function of scanf.
While executing above program the cursor blinks. That indicates program need input from you.
This program print the input what you typed.
In scanf("%d",&a);
&a is the instruction to save your input into a.

(This program for linux. In turbo c you must return a value)





Sunday, August 19, 2012

How to make more money---Loans


  This post is about how to create posts about loans usefully. What is loan?, Why loan?, Who gives loan?, Types of loan?....etc should answered when our post is completed.

   What is loan?

  Loan is a type of debt. In a loan a borrower get money from lender and that money is to be payback with some interest. Banks are who gives loans to us. As possible we should avoid taking loans. Because loan affects the normal life of a human. So take loans when it becomes necessary.
  Sometimes on the basis how much money is taken as loan, the lender ask a asset as security.

 Why loan?

 Why we think about taking loans? Is it necessary?
  Are you in trouble financially, then you can think about loan. But you must investigate about company, from where loan is borrowing. Otherwise you cant escape from their hands and you should be paying they life time.

Who gives loans?

   Banks.
   Credit card is similar to loans. First we uses credit card to purchase something and credit company gives us a time to payback the money.

 Types of loans?

   Loans are in different types. They are secured,unsecured,demand and subsidized loans.

   Secured loans are loans in which borrower gives some asset to lender as loan guarantee.

   Unsecured loans which with no need of guarantees like credit cards, bank overdrafts etc.

   Demand loans  are which do not have any fixed dates for repayment.
 
   Subsidized loans is a loan which gives a subsidy to the interest of the loan. For example, student loans.
 

Saturday, August 18, 2012

How to make more money from google adsense......

         All of us know about high paying keywords in adsense. In this blog i just want to show how make posts from that keywords and obtain more money from that blogs.

         In first, lets see what keywords are they,
Insurance $54.91
Treatment $37.18
Loans $44.28
Attorney $47.07
Mortgage $47.12
Hosting $31.91
Rehab $33.59
Classes $35.04
Transfer $29.86
Recovery $42.03
Software $35.29
Claim $45.51
Trading $33.19
Lawyer $42.51
Donate $42.02
Credit $36.06
Conference Call $42.05
Degree $40.61
Gas/Electricity $54.62
Cord Blood $27.80 .......etc


    In second step we need to write an useful content on this keyword. So first take Insurance keyword. For insurance  a useful content is here. Please try to make another one from this.

INSURANCE

    First we must  write what is insurance. So think really what is insurance.
All of us know that insurance is a one type of risk management. Insurance is divided into several branches in the basis of the field which it covers. Simply we can say that Insurance is a help to us or our family when a accident/disaster is happen. Now we cant find a human without having any type of  insurance. So insurance is very very important.

TYPES OF INSURANCE

    In the basis field we can divide insurance into many types. They are,
Auto insurance
Gap insurance
Health insurance
Life insurance
Home insurance
Casualty insurance.......etc.
   So we need to write about Auto insurance. 
   Auto insurance is insurance which covers the vehicle of policyholder. For this policyholder must pay some money to insurance company as premium. This could not be returnable. When an accident is happen to that vehicle or that vehicle was stolen, owner will get compensation.
  
  Life insurance is taken by a person to overcome financial problems happen to his family when he dead by accident. For this insurance policyholder must pay premium to insurance company. And when policy period is over, policyholder will receive some money.