Write a program to print following series 1 01 010 1010 .?
Program to print one & zero Alternatively
#include
#include
void main()
{
int i,j,n,k=1;
clrscr();
printf("Enter the Iteration Value : ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",k);
if(k==1)
k=0;
else
k=1;
}
printf("\t");
}
getch();
}
Output :
Enter the Iteration Value : 5
1 01 010 1010 10101
Does a subprogram always return a value to the program or subprogram that calls it?
No. In some languages PROCEDUREs don't return a value, FUNCTIONs do; in C (and derivatives) return-type void means no return value. Example:
void Hello (const char *msg) { puts (msg); }
Code to implement memcpy in c?
unsigned char *
memcpy(unsigned char * s1, unsigned char * s2, long size)
{
long ix;
s1= (char *)malloc(sizeof(strlen(s2)));
for(ix=0; ix < size; ix++)
s1[ix] = s2[ix];
return s1;
}
Yes, passing an array name to a pointer assigns the first memory location of the array to the pointer variable. An array name is the same as a pointer to the first location of the array, with the exception that an array name is a r-value, while a pointer is an l-value.
How do you swap two numbers without using third one using pointers?
How do you do.
I am doing well thank you.
Swap two number by using reference operators
A tough assignment, it will make you think.
I think you are confusing reference operators with pointers.
Were I you I would study the section on pointers in your text book or course material.
Write a program to compare two strings with out using strcmp function?
#include
main()
{
//please read two strings int str1 and str2//
while(str1[i]!='/0' &&str2[i]!='/0')
if(str1[i]!=str2[i])
flag=1;
if(flag==1)
printf("equal");
} #include
main()
{
//please read two strings int str1 and str2//
while(str1[i]!='/0' &&str2[i]!='/0')
if(str1[i]!=str2[i])
flag=1;
if(flag==1)
printf("equal");
}
Header codes, or tags, are used in html language. They are used to identify the page and can be text, banner or logo.
Why fixed size array is not efficient?
It's not exactly true. Array with fixes size are efficient, but do not work well when you have to resize your array. This actually is the answer for your question. Fixed size arrays are not efficient if you have to change the size. Also you cannot destroy them and release memory used to save the array (for that you have to use operator new).
More info;
You will write a program that will interact with the user by name and allow for the recording of grades for three classes: Tech, History, and Math. The program will allow the user to determine how many assignments to enter in each class, the name of each assignment, the total value of each assignment, and the users score on each assignment. The program will will write the scores to a file and have the ability to:
Tell the user the high and low score in each class along with the assignment name
Repeat entries back to user by assignment name and score to ensure accuracy
Tell the user their current grade in each class
Tell the user their current gpa based on the overall percentage of each class
In Windows, use notepad.exe; in linux, use program xedit.
How many bytes does an Boolean take in a c program?
There is no boolean in C, we usually use int/short/char to store logical values.
Program to generate tokens from a given expression string?
a promlem to solve an equation or a assigment
What sHow is all possible arrays for the number of plants that bobbie purchased?
You forgot to attach the 'following sHow'
C program to find greatest of three numbers?
# include<stdio.h>
main()
{
int a,b,c;
print f("enter the values of a,b,c");
scan f("%d%d%d",&a,&b,&c);
if((a>b)&&(a>c))
print f("Greatest value is a =%d",a);
else if((b>a)&&(b>c))
print f("Greatest value is b=%d",b);
else
print f("Greatest value is c=%d",c);
}
Is it true that in Unsigned char signed value is represented by 1 in most significant bit?
All possible values of an unsigned char are unsigned, so there is no bit that "represents a signed value."
With an 8-bit byte, 1 in the most significant bit of an unsigned char represents the value 128. Consequently unsigned chars with a 1 in this position have values between 128 (when all other bits are 0) and 255 (when all other bits are 1).
C is a low level programming language or it is also called as machine level language as the code written in C is encrypted into machine readable form then it is executed.
If you want to learn C programming language in depth then Newtum is a best option to start with. It's C programming online course provides complete knowledge of the all the basic concepts involved in programming.
If you are interested, please vivist our website!
What is the normal way to button a dress shirt Bottom up or top down?
Up, because it helps you to elevate your bust.
What is the definition of execute?
Execute means to perform an action. To execute a turn is to make a turn. To execute a jump, or play, is to actually complete the activity. To execute a computer program is to actually run it on the computer.
Another common use is to mean to kill, either as capital punishment or a murder done in a similarly dispassionate manner.
Then data will be lost. Quite often, at least in Java, the compiler will protest at compile time, basically forcing you to rethink your strategy.
if (cond1) statement1
else if (cond2) statement2
...
else if (condn) statementn
else statemente;
(Note: each statement can be a {block})