1. You have calculate the power of r before assigning a value to it
2. The scanf function isn't used properly
3. M_PI is already defined in math.h
4. You haven't declare volumeCylinder before using it
Try this:
Code:
#include <stdio.h>
#include <math.h>
// this function calculates the volume of a Cylinder
int main(void)
{
int r; // radius
int h; // height
double volumeCylinder;
// get user input of radius and height
printf ("Enter your radius: ");
scanf ("%d", &r);
printf ("Enter your height: ");
scanf ("%d", &h);
// calculate volume
int pOne = pow (r, 2);
volumeCylinder = pOne * M_PI * h;
// output volume result
printf ("The Volume of the Cylinder is: %lf\n", volumeCylinder);
return 0;
}
Hi Folks!
Can you help me with this find -printf command. I seem to be unable to execute the printf-command from my shell script. I'm confused: :confused:
My shell script snippet looks like this:
#!/bin/sh
..
COMMAND="find ./* -printf '%p %m %s %u %g \n'"
echo "Command: ${COMMAND}"... (1 Reply)
Hi
I'm using awk to manipulate the data in the 6th field of the file xxx_yyy.hrv.
The sample data that is available in this field is given below
220731.7100000000000000
When i tried using this command
cat xxx_yyy.hrv | awk '{printf("%23.16f\n",$6*-1)}'
I get the output as... (4 Replies)
Hi ,
I wonder if in java I can pipe the below output of the printf into a variable:
System.out.printf(" This is a test %s\n", myVariable);
I want to keep the output of the printf command to create my history array.
Thanks. (2 Replies)
printf "%X\n" "A"
41
printf "%X\n" "2"
2
Expected 32 (not 2).
Is there a "printf" which will output the hexadecimal value of a numeric character? (9 Replies)
Hi,
i have a script, which is incomplete, am on my way developing it.
Input
1,12,2012,IF_TB001
2,12,2012,3K3
3,Z56,00000,25,229,K900,00, ,3G3, ,USD, ,0000000000,000, , , , 550000000
3,Z56,00000,53,411,W225,00,000, , ,USD,OM170,0000000000,000, , , , -550000000
4,Z56,COUNT, 4,SUM LOC,... (19 Replies)
Hi All;
I try to create a excel like table with headers and some fields containing values, other long and complex mathematic formulas.
I have some header like : Name Formula Value True/False
Under name column, they are some formula names, formula column some long mathematic formulas... (9 Replies)
Hello script guru's
as i write more and more code i always block at managing output... either writing to standard out, writing to files via std out (log, temp file, etc). Don't get me wrong 99% of the time it DOES the job but maybe there is more efficient.
I'm writing a small script to... (2 Replies)
So I created two shell variables: COLUMN1_HEADING, COLUMN2_HEADING.
They have values:
COLUMN1_HEADING="John"
COLUMN2_HEADING="123456789"
How would I use printf to get it to print an output like this: $COLUMN1_HEADING\t$COLUMN2_HEADING\nJohn\t123456789\n
Thanks! (3 Replies)
Discussion started by: steezuschrist96
3 Replies
LEARN ABOUT NETBSD
iteconfig
ITECONFIG(8) BSD System Manager's Manual ITECONFIG(8)NAME
iteconfig -- modify console attributes at run time
SYNOPSIS
iteconfig [-i] [-f file] [-v volume] [-p pitch] [-t msec] [-w width] [-h height] [-d depth] [-x offset] [-y offset] [color ...]
DESCRIPTION
iteconfig is used to modify or examine the attributes of the console bell and bitmapped console display. The console bell's volume, pitch,
and count may be specified, as well as the bitmapped display's width, height, horizontal and vertical offset, pixel depth, and color map.
The following flags are interpreted by iteconfig:
-i After processing all other arguments, print information about the console's state.
-f Open and use the terminal named by file rather than the default console /dev/ttye0.
-v Set the volume of the console bell to volume, which must be between 0 and 63, inclusive.
-p Set the pitch of the console bell to pitch, which must be between 10 and 1399.
-t Set the duration of the beep to msec milliseconds which must be between 1 and 5000 (5 seconds).
-w Set the width of the console display to width pixel columns. Width must be a positive integer.
-h Set the height of the console display to height pixel rows. Height must be a positive integer.
-d Set the number of bitplanes the console view should use to depth. For example, if depth is 3 then 8 colors will be used.
-x Set the horizontal offset of the console view on the monitor to offset pixel columns. The horizontal offset may be a positive or a
negative integer, positive being an offset to the right, negative to the left.
-y Set the vertical offset of the console view on the monitor to offset pixel rows. The vertical offset may be a positive or a negative
integer, positive being an offset down, negative up.
Any additional arguments will be interpreted as colors and will be used to supply the color values for the console view's color map, starting
with the first entry in the map. (See the COLOR SPECIFICATION section of this manual page for information on how to specify colors.) If
more colors are supplied than are usable by the console view, a warning is printed and the extra colors are ignored.
COLOR SPECIFICATION
Colors are hexadecimal numbers which have one of the following formats:
0xRRGGBB RR, GG, and BB are taken to be eight-bit values specifying the intensities of the red, green and blue components, respectively, of
the color to be used. For example, 0xff0000 is bright red, 0xffffff is white, and 0x008080 is dark cyan.
0xGG GG is taken to be an eight-bit value specifying the intensity of grey to be used. A value of 0x00 is black, a value of 0xff is
white, and a value of 0x80 is a grey approximately half way in between.
0xM M is taken to be the one-bit monochrome value to be used. A value of 0x1 is black, and a value of 0x0 is white.
BUGS
The iteconfig command is only available on the amiga and atari ports.
BSD February 3, 1994 BSD