السلام عليكم
انا عندي برنامج ++c وعندي مشكله في برنامج
هذا سؤال البرنامج
Given the following number representing a pattern:
2053 = 2^0 + 5^3 = 1 + 125 = 126
Look above at the number "20"; in this sequence it represents 2 to the 0 power which is 1. The other number "53" represents 5 to the 3rd power which is 125. Then final answer is calculated by the sum of each term.
Given this number below: 342345820139586830203845861938475676
Write a C++ Program to make it for the above pattern?
انا انتهيت من كتابة البرنامج لكن للاسف فيه مشكله بالبرنامج ومو راضي يشتغغل معايا
هذا الكود
#include <iostream.h>
#include <math.h>
using namespace std;
int main ()
{
long long sum = 0 ;
char c [] = "342345820139586830203845861938475676" ;
float num = 0 , exp = 0 ;
for ( int i = 0 ; i<36 ; i+=2)
{
num = c - '0' ;
exp = c[i+1] - '0' ;
sum += pov (num, exp );
}
cout << sum << endl ;
system("pause");
return 0;
}
مادري وش الخطا وما اشتغل معي
ارجو المساعده
شاكر ومقدر مقدما




