I have to write a c program which takes a 3 digit number n and calculates the value of (2^n)+1 and then determines the number is prime or not.
I have tried to first calculate the value of 2^n and then adding one to it and then apply the logic of prime number.
but the ultimate problem is that if n is a 3 digit number for example 100
then 2^100 becomes a huge number for which my program is returning the same value of 2^100 and 2^100+1
for 2^50 and 2^50+1 it returns correct values with the diff of 1.
Please help me out here.
Hi,
Was wondering if you could give me an example of extracting a 10 digit number from 5 txt files using a regular expression (the number is always different ) and storing the numbers in variables
Thanks
C19 (9 Replies)
i am new to shell scripting. i want to keep on increamenting a 6 digit number. For eg. 000000 + 1 = 000001 But instead of 000001 i get only 1. How do i do this ? Pls help. (8 Replies)
how can i list all files in my home directory that have a 4 digit id number, the line number where the id is located and the id itself not printing the entire line? (5 Replies)
I want to write/print a number through a shell script up to its last significant digit (LSD) after the decimal point.
Say,
x=10.00056000000000000
I want to print x as x=10.00056.
Note that x can be any thing so I cannot know the position of the LSD always.
Thanks. (16 Replies)
Hello Team,
i have a file test1.txt, in which i have to grep only the 6 digit number from it,
Could you pls help in this.
$cat test1.txt
<description>R_XYZ_1.6 r370956</description>
$ grep "\{6\}" test1.txt
<description>R_XYZ_1.6 r370956</description>
i need output as 370956.
... (3 Replies)
Dear All,
Lets say I have a number with following format:
####.12e-##
now I want to compare place holder in position 1 and 2.
How can I do that?
Note: My number is stored in a variable say var.
example:
var=9999.12e-05
Thanks & Regards,
linuxUser_ (6 Replies)
I am trying to process only IonCode_odd #'s (always 4 digits starting with zero), but the below isn't working as expected. Is there a better way? Thank you :).
IonCode_0401_xxxx_xxxx_xxxx.bam
IonCode_0401_xxxx_xxxx_xxxx.bam.bai
IonCode_0401_xxxx_xxxx_xxxx.fastq... (2 Replies)
I all
I am tryng to find a way to sort a list of number in a file by the value of last two digit.
i have a list like this
313202320388
333202171199
373202164587
393202143736
323202132208
353201918107
343201887399
363201810249
333201805043
353201791691 (7 Replies)
Discussion started by: rattoeur
7 Replies
LEARN ABOUT ULTRIX
vfprintf
vprintf(3int)vprintf(3int)Name
vprintf, vfprintf, vsprintf - print formatted output of a varargs argument list
Syntax
#include <stdio.h>
#include <varargs.h>
int vprintf ( format, ap )
char *format;
va list ap;
int vfprintf ( stream, format, ap )
FILE *stream;
char *format;
va list ap;
int vsprintf ( s, format, ap )
char *s, *format;
va list ap;
Description
The international functions and are similar to the standard I/O functions.
Likewise, the vprintf functions are similar to the printf functions except they are called with an argument list as defined by instead of
with a variable number of arguments.
The international functions allow you to use the %digit$ conversion character in place of the % character you use in the standard I/O
functions. The digit is a decimal digit n from 1 to 9. The international functions apply conversions to the nth argument in the argument
list, rather than to the next unused argument.
You can use the % conversion character in the international functions. However, you cannot mix the % conversion character with the %digit$
conversion character in a single call.
You can indicate a field width or precision by an asterisk (*) instead of a digit string in format strings containing the % conversion
character. If you use an asterisk, you can supply an integer arg that specifies the field width or precision. In format strings containing
the %digit$ conversion character, you can indicate field width or precision by the sequence *digit$. You use a decimal digit from 1 to 9
to indicate which argument contains an integer that specifies the field width or precision.
The conversion characters and their meanings are identical to
You must use each digit argument at least once.
Examples
#include <stdio.h>
#include <varargs.h>
main()
{
char *function_name = "vpr";
char *arg1 = "hello world";
int arg2 = 2;
char *arg3 = "study";
char *i18nfmt = "%1$s %3$d
";
test(function_name, i18nfmt, arg1, arg2, arg3);
}
test(va_alist)
va_dcl
{
va_list args;
char *fmt;
char string[1024];
va_start(args);
(void)printf("function %s: ", va_arg(args, char *));
fmt = va_arg(args, char *);
(void)vprintf(fmt, args);
va_end(args);
}
See Alsosetlocale(3), scanf(3int), printf(3s), printf(3int), vprintf(3s), putc(3s), scanf(3s), stdio(3s), varargs(3)
Guide to Developing International Software
vprintf(3int)