Tuesday 8 July 2014

53)program to find the sum of reciprocal of integer numbers.

#include<iostream>
using namespace std;
#define AND &&
int main()
{
float n1,n2,sum;

cout<<"enter the number n1";
reenter:

cin>>n1;
if(n1==0)
{   cout<<"reenter the number n1 "<<endl;
   cout<<"reciprocal of zero is not define";

        goto reenter;
}

n2=1/n1;
sum=n1+n2;
cout<<"sum of two reciprocal number is  "<<sum<<endl;

No comments:

Post a Comment

Write a program which reads a set of integers into an integer array and then prints "YES"if all of them are same otherwise print "NO".

#include<stdio.h> int main() { int a[10],M=0,i,n; printf("enter a value for n\n"); scanf("%d",&n); fo...