For a homework assignment in my intro to java class I was given the following problem: Write for, do-while, and while statements to compute the following sum and product 1. 1 + 7 + 25 + 79 + .... + (3^20 - 2) 2. 1 x 3 x 9 x 27 x 81 x ... x (3^20) I understand how to write the statements, I'm just not sure how to express the increment. For the first one (for statement) I have int i, sum = 0; for (i = 1; i =< 2486784399; // I'm not sure what would go …

Member Avatar
Member Avatar
+0 forum 6

Hi Team, I have a file which contain following data like BKP0000032183140217000019 053IGZYEVSDOX .........field 2....... field3.....field4..... BKP0000032284140217000019CCTP1220 ............... BKP0000032384140217000019CA ..................... each line has 5 fields Now using shell script i am trying to extract field 4 based on condition that line start with BKP and contain code 84 and CA or CC code grep -A12 " RFND " xfer_BSPDe | grep "^BKP" >file2.txt While read line do awk '{if((substr($1,12,2)==84) && (substr($1,26,2)=='CC' || substr($1,26,2)=='CA') ) print $4;else print "0"}' done<file2.txt it is printing 0 only . any help is appreciable.

Member Avatar
Member Avatar
+0 forum 3

Hi every body.i want to make a factorial program with do while loop in the easiest way without using 'for' loop but i cant do that.please help me out!

Member Avatar
Member Avatar
+0 forum 1

Hi everyone! So, I hereby hope to show that I've made progress in coding java (largely due to the help of this great community). I want to thank everyone for dealing with me (especially James). :) The goal: The code below is supposed to seed a layout of boats into a 2D array. This is part 1 of an excersize I've given myself - create code to seed boats horrizontally and vertically, boats must not collide, boats must not be out of bounds. The issue: Usually the layout comes out just fine. But sometimes, some boats are missing in length …

Member Avatar
Member Avatar
+0 forum 32

Hello, I am new to C++ and I was trying to write a simple calculator program that has a do-while loop and also includes a series of != statements. Even though I make the statements with all the appropriate keystrokes it keeps giving me my invalid sign statement. Also, I would like to know if I used the "while" statement properly. Thank you for your help in advance =D! #include <iostream> #include <math.h> #include <string> using namespace std; int result,value; char sign; int main() { result = 0; do { cout<< "Current value is "<<result<<endl; cout<< "Please enter an operation …

Member Avatar
Member Avatar
+0 forum 8

1.Make and run a program that will output all the prime numbers from 1-100. (FN do prime) 2.make and run a program that will allow the user to input 10 numbers and display the total number of positive and negative numbers entered. 3. write a program that reads numbers until number is less than or equal to 100. can you make that program using do while functions ?? i've already did the third problem though. #include<stdio.h> #include<conio.h> main() { int a=0; do { printf("%d ",a); a=a+1; } while(a<101); getch(); }

Member Avatar
Member Avatar
+0 forum 4

what is the procedure of linux installation

Member Avatar
Member Avatar
+0 forum 1

I was looking at some sample code [here](http://www.kernel.org/doc/man-pages/online/pages/man2/mmap.2.html) and it had this for error handling: #define handle_error(msg) \ do { perror(msg); exit(EXIT_FAILURE); } while (0) If I remember correctly do {} while (0) would execute only once, so what is the point of this?

Member Avatar
Member Avatar
+0 forum 1

![homework2](/attachments/large/3/homework2.png "homework2") ![homework3](/attachments/large/3/homework3.png "homework3") ![homework4](/attachments/large/3/homework4.png "homework4") ![homework](/attachments/large/3/homework.png "homework") The name of program is i think it is function and structured programming waa hard to explain ahmm.. if you input a number 1 temperature must be goes in program then after that i need to input an exit like "ARE YOU SURE YOU WANNA EXIT?" then Y for yes N for No. if no the program stay in the program in temperature if yes she will back in the menu in 1-10 then pick again please i need this thank you!!!! first timer in this site :)

Member Avatar
Member Avatar
+0 forum 3

Hello, I am hoping someone can help me understand a piece of code i found. Since php is not my primary language, and what i googled returned vague results, i am unsure exactly how a number or integer value can be used directly as a boolean in a while operation. function testfunction( $testparam ) { if( $testparam > 0x3F3F3FFF ) { $testparam &= 0x3F3F3FFF; } do { $testparam >>= 6; }while($testparam); } Basically i need to be able to understand the logic of the while loop here, does it check it testparam is > 0 and evaluate that as true …

Member Avatar
Member Avatar
+0 forum 1

is it possible?? $a= 5; $b =10; $c= "+" $d= $a.$b.$c; How can I do dynamic calculation like this. I know this code will not work. But Just want to use opereater directly input through form. How can I prevent opreater to converting into string.

Member Avatar
Member Avatar
+0 forum 3

Hi All I wanted to write string.contains() in jdk 1.4, but i know 1.4 doesn't support contains is there any way to do the same ex: if the string contains "," i want check the condition String name; if(name.contains(",")) is there any way to do in jdk 1.4 Regards Ravi

Member Avatar
Member Avatar
+0 forum 4

The End.