Question about Intel Compilers & Programming Tools

1 Answer

Base and exponet soucre code(recursor)

How to program a base and exponent in recursion?

Posted by on

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    MVP:

    An expert that got 5 achievements.

    Vice President:

    An expert whose answer got voted for 100 times.

    Governor:

    An expert whose answer got voted for 20 times.

  • Expert
  • 139 Answers

Hi Dear,
here is the code in c, for positive integeral exponent, you can convert it in any other programming language.

#include "math.h"
float (float base, unsign int expo)
{
int x=abs(expo), i;
if (x<=1)
return(base);
else
return(base*float(base, expo-1);
}

Hope this will help you out.
for any clarification please feel free to contact me

bye
Zulfikar Ali
ali_zulfikar@yahoo.com
09899780221

Posted on Mar 03, 2009

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

2 Answers

I'm trying to divide the word video into 2 syllables and it's not working, could you please help me?


Are you trying to do this in a programming language?
BTW "Video" is 3 syllables.

Feb 26, 2014 | Compilers & Programming Tools

1 Answer

Codes of BufferedReader and FileInputStream in one program


class base
{
int a,b;
void display(int x,int y )
{
a=x;
b=y;
}
void dismax()
{
display();
if(a>b)
System.out.println("first Value is greater"+a);
else
{
}
}
}
class dervd extends base
{
void dismin()
{
display();
if(b>a)
System.out.println("second value is greater"+b);
else
{
}
}
public static void main(String args[])throws IOException
{
BufferedReader in= new BufferedReader (new InputStreamReader(System.in));
System.out.println(" Enter 1st value");
String s=in.readLine();
int m=Integer.parseInt(s);
System.out.println(" Enter 2nd value");
String s1=in.readLine();
int n=Integer.parseInt(s1);

base b1=new base();
b1.display(m,n);
b1.dismax();
dervd d1=new dervd();
d1.dismin();
}
}

Oct 03, 2011 | ArcMedia JavaScript Source Code 3000 Pro...

1 Answer

What do you mean recurrence relation in computer science? advantage and disadvantages in recurrence relation in computer science? what do you mean sequence? in computer science? what are the importance...


Recursion in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem. The approach can be applied to many types of problems, and is one of the central ideas of computer science.Most computer programming languages support recursion by allowing a function to call itself within the program text. Some functional programming languages do not define any looping constructs but rely solely on recursion to repeatedly call code. Computability theory has proven that these recursive-only languages are mathematically equivalent to the imperative languages, meaning they can solve the same kinds of problems even without the typical control structures like "while" and "for".In computer science, a list or sequence is an abstract data structure that implements an ordered collection of values, where the same value may occur more than once. An instance of a list is a computer representation of the mathematical concept of a finite sequence, that is, a tuple. Each instance of a value in the list is usually called an item, entry, or element of the list; if the same value occurs multiple times, each occurrence is considered a distinct item.

Jun 30, 2011 | Compilers & Programming Tools

1 Answer

Wirte a pogram in java using for loop,that will print out the first 1 numbers of a fibonacii series that is:1 1 2 3 5 13 21 34 55


package com.gpt;

import javax.swing.JOptionPane;

/*
This program computes Fibonacci numbers using a recursive
method.
*/
public class Fibonacci
{
public static void main(String[] args)
{
String input = JOptionPane.showInputDialog("Enter n: ");
int n = Integer.parseInt(input);

for (int i = 1; i {
int f = fib(i);
System.out.println("fib(" + i + ") = " + f);
}
System.exit(0);

}

/**
Computes a Fibonacci number.
@param n an integer
@return the nth Fibonacci number
*/
public static int fib(int n)
{
if (n return 1;
else
return fib(n - 1) + fib(n - 2);
}
}

Feb 24, 2011 | Sun Java Programming Language (cdj-275)

1 Answer

JavaBat.Com


/* REXX is better than JAVA */
input = '17273747'
x = count7(input)
say 'number of "7" characters is:' x
exit

count7: parse arg digit 2 tail
if digit = ' ' then return(0)
match = (digit = '7')
return (match + count7(tail))

i.e., split the "input" into the 1st column and the "tail" (the other columns).
If there is no "first" column, return '0' ("none").
Test the 1st column.
Recursively call the function, passing the "second-through-last" columns, adding-in the result (0 or 1) from the 1st column.

Mar 26, 2010 | Sun Java Programming Language (cdj-275)

1 Answer

How to convert a Java Desktop application to Web-based?


1. No, it will take lots of code changes
2. Maybe
3. That depends on what its functions are
4. You may not have to convert it at all
5. Maybe, that's your choice

Oct 22, 2009 | Sun Compilers & Programming Tools

1 Answer

HOW TO USE text.formatDouble in java


You can use these calls:

formatDouble(double inVal, int inDecs, int inLeftOfDec)
formatDouble(double inVal, int inDecs, int inLeftOfDec, boolean recursing)

inVal - double number to be formatted
inDecs - minimum significant figures
inLeftOfDec - number of fixed decimals

As far as I remember java, you use it like this:
String s;
s.formatDouble(34.5566, 2, 3);

Oct 07, 2009 | Compilers & Programming Tools

1 Answer

I am getting the C2664:Can't convert parameter 1 to LPCSTR


Parameter 1 is probably not a string. If fact based on the code snippet it looks like parameter 1 "sring1" maybe should be spelled "string1"

Feb 24, 2009 | Microsoft Visual Studio 2008 Professional...

1 Answer

Auto-Delete in just one click


You need to use the FileSystemObject of the Scripting Runtime library. See here. This library is not part of the standard VB references by default so remember you will have to find it in the "References" list and check it so that it is added to your project; it is under "References" as "Microsoft Scripting Runtime Library". However bear in mind that calls to delete files from a VB app are high-level requests to the O/S, not direct kernel commands. If you have any kind of file lock contention you won't be able to delete a given file.

The best way to blast an entire drive would be use the DOS 'format' command. You cannot run 'format' though on the system drive, and it will take longer to format a drive than to erase all files, though formatting will really do it. You would use the Shell command in VB to execute the DOS command.

See here and here.

You can also use the Shell command to execute the "del" DOS command recursively against the drive. The FileSystemObject is basically doing that under the covers, so it's not too far away. Finally, you can use API code to do it, though I am guessing you are not quite there yet in your experience. But if so, take a look at these articles:

http://allapi.mentalis.org/vbtutor/iapi2.shtml
http://www.devarticles.com/c/a/Visual-Basic/Accessing-the-Windows-API-in-Visual-Basic/2/

Mar 30, 2008 | ArcMedia JavaScript Source Code 3000 Pro...

Not finding what you are looking for?
Compilers & Programming Tools Logo

Related Topics:

93 people viewed this question

Ask a Question

Usually answered in minutes!

Top Intel Compilers & Programming Tools Experts

Michael Thomas
Michael Thomas

Level 3 Expert

3051 Answers

Robin Hill
Robin Hill

Level 3 Expert

1251 Answers

kakima

Level 3 Expert

96738 Answers

Are you an Intel Compiler and Programming Tool Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...