#! /usr/bin/env ruby
n = gets.to_i
d = 'is not'
d = 'is' if n % 7 == 0
puts 'Your number ' + d + ' divisible by seven.'
For more accurate answer, please define the programming/script language you plan to use..
What are the characteristic features of c language?
In which cases should you use the far pointers?
Far pointers are generally used with 16 bit windows application. You can also use for DOS based application for accessing VDU memory since it has huge pointer and it can be fit into the far pointers.
Well, Win32 does not distinguish between near and far addresses. Because the types NEAR and FAR are defined in WINDEF.H, they are automatically handled by the include file, which redefines them as empty strings for Win32. Thus, NEAR and FAR are ignored. If you do not include WINDEF.H, a convenient solution is to use the /D command-line option to replace the keywords by empty strings. For example:
/D_near= /D_far= /D__near= /D__far=
The increased address-space size in 32-bit Windows impacts 16-bit code in several ways:
Pointers are all 32 bits wide and are no longer near or far, and your code cannot make assumptions based on segmented memory. Window handles, handles to other objects (such as pens, brushes, and menus), and graphics coordinates have increased to 32 bits. Thus, you cannot use types such as WORD interchangeably with HWND as you could in 16-bit Windows. Message handlers must be rewritten because the different sizes can change the way information is packed in some message parameters. The larger size of graphics coordinates affects a number of function calls. The key areas of 16-bit code affected by these changes are:
Window procedure declarations, Near and far type declarations, Data types, Messages, Calls to API functions, WinMain function
Which flowchart symbol indicates the need to make a decision?
When there is a trigger for the event,:
Example:
When you need to determine if a grade passed or not.
Start->input grade(input or output)->is G>=75?(i just put 75 because the passing here is 75%, and use decision symbol, now there are two flowlines that will come out of the decision symbol, follow this: right- TRUE, down- FALSE, use a processing symbol then, if true...)->print pass(processing symbol, true, right of the DS, if false...)->print failed(processing symbol, false, down of the DS) then make sure that the end terminal would below the false, then in case you might wonder if the TRUE will be left, just use a flowline to connect it on the flowline before the end(i mean between the false Processing box and the end terminal)! So i hope that helps you!
Rekun- peace out!
Write a C program to find a given number is automorphic or not?
#include<stdio.h>
#include<conio.h>
void main()
{
int s,c,p,n,i,t;
printf("Enter a number:");
scanf("%d",&n);
s=n*n;
c=0;
p=1;
t=n;
while(n!=0)
{
c++;
n=n/10;
}
for(i=1;i<=c;i++)
p=p*10;
if(s%p==t)
printf("The number is automorphic.");
else
printf("Not automorphic.");
getch();
}
How do you write a C program to print your name one hundred times?
Duhh..
printf("hello ");
printf("hello ");
printf("hello ");
printf("hello ");
printf("hello ");
printf("hello ");
printf("hello ");
printf("hello ");
printf("hello ");
Just kidding.
Just loop the printing.
int x = 0;
for(x = 0; x<11; x++)
{
printf("hello ");
}
and if you want each "hello" to be in a new line, use this:
printf("hello\n");
Linker and loader in c language?
There is no such thing in the C language, but it is true that operating systems have a component called loader which loads binary program-files (whose source may be written in C language) into the memory and prepares them to the execution.
How do you write a c program to print all prime numbers from 1 to n by using while loop with output?
100% working
void main()
{
int n,i=1,j,c;
clrscr();
printf("Enter Range To Print Prime Numbers")
scanf("%d",&n);
printf("Prime Numbers Are Following;
while(i<=n)
{
c=0;
for(j=1;j<=i;j++)
{
if(i%j==0)
c++;
}
if(c==2)
printf("%d ",i)
i++;
}
getch();
}
How do you print 1 to 100 without using loop in c?
You can use recursion:
void printNum(int i)
{ if(i <= 100)
{ printf("%d\n", i);
printNum(i + 1); } }
int main()
{
printNum(1);
return 0;
}
Difference types of nonlinear data structure?
Tree, Graphs are the types of nonlinear data structure.
What is good programming style?
There are 2 major goals easily to say than done in any programming:
Any technique that can lead you to those 2 goals are superbly good.
Flowchart to check if 12321 is palindrome or not?
i dnt have time to draw flow chart but i'll give the algorith..(only major steps)
1 :read n
2:m=n
3:if n=0 goto step 8,else goto step 4
4:r=n%10
5:rev=(rev*10)+r
6:n=n/10
7:goto step3
8:if m==rev,display "palindrome" else "not palindrome
9:stop
How to write an effective program using c plus plus?
Here is a simple program that will tell you how to make an algorithm:
int main();
{
int length;
int width;
int total;
printf("What is the width: ");
scanf("%d", &width);
printf("What is the length: ");
scanf("%d", &length);
total = width * 2 + 2 * length; /*Here is the algorithm for finding the perimeter of a square*/
printf("The perimeter is: %d", total);
return 0;
}
Output:
What is the width: 32
What is the length: 55
The perimeter is: 174
Tomcat
Write a c program to find Armstrong number using ifstatement?
#include<stdio.h>
int main(){
int num,r,sum,temp;
int min,max;
printf("Enter the minimum range: ");
scanf("%d",&min);
printf("Enter the maximum range: ");
scanf("%d",&max);
printf("Armstrong numbers in given range are: ");
for(num=min;num<=max;num++){
temp=num;
sum = 0;
while(temp!=0){
r=temp%10;
temp=temp/10;
sum=sum+(r*r*r);
}
if(sum==num)
printf("%d ",num);
}
return 0;
}
How do you print 1 to 10 numbers using while loop in C?
#include <iostream>
int main()
{
int i=0;
while( i<10 )
printf( "%d\n", ++i );
return( 0 );
}
What is the difference between dynamic implementation and linked list implemention?
The size or length of the list. For static, the size is a constant, while the size of a dynamic list may change over time.
The 7 weekdays is static (in size/length, though the content is static as well), while the questions and answers at answers.com are 2 dynamic lists (the sizes are not constants, although just growing)
What is the difference between null and void pointers?
A void pointer is a pointer that has no type information attached to it.
A null pointer is a pointer that points to "nothing". A null pointer can be of any type (void included, of course).
What is the decimal equivalent of 0XFFFF?
0X at the beginning represent a number in the hexadecimal system of units.
FFFF is the hexadecimal equivalent of
i) 65535 in decimal system of units
ii) 1111111111111111 in binary system of units
What is the decimal conversion of the binary number 1111 1111 1111?
4+2+1
A bit is a 1 or a 0
A byte is typically 8 bits, in which case it can have a value between 0 and 255.
There are 2 possible values for each digit and there are 8 digits. 28 is 256. Because 0 is also a number, 11111111 is equal to 255 (decimal) rather than 256.
The first digit is 20, the second digit is 21, the third digit is 22, and so on. The 1 is a yes and the 0 is a no.
20 = 1
21 = 2
22 = 4
23 = 8
24 = 16
25 = 32
26 = 64
27 = 128
So 10101101 would be:
[1 x 27] + [0 x 26] + [1 × 25] + [0× 24] + [1 × 23] + [1 × 22] + [0 × 21] + [1 × 20] =
[1 x 128] + [0 x 64] + [1 × 32] + [0× 16] + [1 × 8] + [1 × 4] + [0 × 2] + [1 × 1] =
128 + 32 + 8 + 4 + 1 = 173
So, 10101101 = 173
A more specific answer to you question:
00000111
[0 x 27] + [0 x 26] + [0 × 25] + [0× 24] + [0 × 23] + [1 × 22] + [1 × 21] + [1 × 20] =
[0 x 128] + [0 x 64] + [0 × 32] + [0× 16] + [0 × 8] + [1 × 4] + [1 × 2] + [1 × 1] =
4 + 2 + 1 = 7
So, 00000111 = 7
What is calling by reference How it is different from call by value?
Call By Value, the standard way of doing things in C and C++, is where a copy of an object is placed in the parameter stack. The called function can access and manipulate that copy at will, but it cannot change the original copy because it has no way of knowing where that original copy is located.
Call By Reference, on the other hand, is where the address of an object is placed in the parameter stack. Using extra syntax, the * or the ->, the called function can access and manipulate the original copy at will.
Write a java program to create human face?
Try this for a very, very simple face....
String hair = " /////// ";
String eyes = " | o o | ";
String noseEars = "(| ^ |)";
String mouth = " | [ ] | ";
String chin = " ------ ";
System.out.println(hair); //prints out the hair
System.out.println(eyes); //prints out the eyes
System.out.println(noseEars); //prints out the nose and ears
System.out.println(mouth); //prints out the mouth
System.out.println(chin); //prints out the chin
What are generalised linked list?
A generalized linked list contains structures or elements with every one containing its own pointer. It's generalized if the list can have any deletions, insertions, and similar inserted effectively into it.