Here is the required code.... to count the no. of nodes in a singly linked list..
#include < stdio.h>
#include < conio.h>
#include < malloc.h>
#include < process.h>
#include < ctype.h>
struct linear_list
{
int info;
struct linear_list *next;
}*start,*newnode,*ptr;
void main()
{
int item,num;
int i;
char ch;
clrscr();
newnode=(struct linear_list*)malloc(sizeof(struct linear_list));
start=newnode;
do
{
printf("\nEnter data: ");
scanf("%d",&item);
newnode->info=item;
printf("\nDo you want to create another node:(y/n)");
fflush(stdin);
scanf("%c",&ch);
if(tolower(ch)=='y')
{
newnode->next=(struct linear_list*)malloc(sizeof(struct linear_list));
newnode=newnode->next;
}
else
{
newnode->next=NULL;
}
}while(tolower(ch)!='n');
printf("\n Linked List is:\n");
ptr=start;
i=1;
while(ptr!=NULL)
{
printf("\nNode %d : %d",i,ptr->info);
ptr=ptr->next;
i++;
}
num=0;
ptr=start;
while(ptr!=NULL)
{
ptr=ptr->next;
num++;
}
printf("\nThe number of nodes in the linked list are: %d",num);
getch();
}
how to write a program that counts automorphic number from 1 to 999
program that take three decimal number as input and find the largest among them in assembly language
public int getStringLength(String val) { return val.length(); } There is an inbuilt functionality in strings that counts the number of alphabets in a string called length()
swap(&grades[num],&grades[num+1]); what it make in a program?
I would use a loop like this: const char *p= str-1; size_t count= 0; while (*++p) if (islower (*p)) ++count;
Use text-editor notepad++
how to write a program that counts automorphic number from 1 to 999
A program which is used to count the number of numbers in an array using a 8085 microprocessor is known as a assembly language program.
program that take three decimal number as input and find the largest among them in assembly language
Some people have realised that dividing by zero or 0 will not work. Any program which counts down from a large number to 0 wil stop the program.
public int getStringLength(String val) { return val.length(); } There is an inbuilt functionality in strings that counts the number of alphabets in a string called length()
8086 assembly language program to check wether given number is perfect or not
You may be thinking of counts in yarn, where counts can indicate the number of twists per inch in the spin.
It is not the number, it is how it is applied that counts
substracion of any two number program in c
swap(&grades[num],&grades[num+1]); what it make in a program?
It will probably be this number.