Showing posts with label C Program Code. Show all posts
ARMSTRONG number C++ Program Code
include<iostream.h>
include<stdio.h>
include<conio.h>
class test
{
private:
int n,a,b,s;
public:
void getdata()
{
cout<<"\n\n\n -> Enter The Number:- ";
cin>>n;
s=0;
b=n;
}
void putdata()
{
while(n>=1)
{
a=n%10;
s=s+(a*a*a);
n=n/10;
}
// cout<<"\n Your Revers Number Of:- ";
//cout<<s;
if(b==s)
{
cout<<"\n\n This Is Armstrong Number are ";
}
else
{
cout<<"\n\n this Number is not Armstrong Number are ";
}
}
};
void main()
{
clrscr();
test t1,t2,t3;
t1.getdata();
t1.putdata();
t2.getdata();
t2.putdata();
t3.getdata();
t3.putdata();
getch();
}
Thanks & Regards
-Yagnik Gorasiya
Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).
Note: *Remove The Sentence on this program ___(Don't Missing Syntax required).
Single Link List Last Code in C Programming Turbo C
#include<stdio.h>
#include<conio.h>
struct linklist
{
int
no;
struct
linklist *next;
};
typedef
struct linklist node;
void main()
{
void
display(node*);
void
create(node*);
void
insertlast(node *);
node*head;
clrscr();
head=(node*)malloc(sizeof(node));
create(head);
insertlast(head);
display(head);
getch();
}
void
create(node* list)
{
printf("Enter
no,-1 for end");
scanf("%d",&list->
no);
if(list->
no==-1)
list->
next=NULL;
else
{
list->next=(node*)
malloc(sizeof(node));
create
(list-> next);
}
}
void
display(node * list)
{
while(list->
next!=NULL)
{
printf("%d",list->no);
list=list->
next;
}
}
void insertlast(node *list)
{
node
*new1;
new1=(node
*)malloc(sizeof(node));
while(list->next!=NULL)
{
list=list->next;
}
list->next=new1;
new1->next=NULL;
printf("Enter
no");
// list->no=100;
scanf("%d",&list->no);
}
Single Link List insert Code in C Programming Turbo C
#include<conio.h>
void main()
{
int
insertlast(node*);
node*head;
head=(node*)malloc(sizeof(node));
creat(head);
display(head);
head=insertlast(head);
display(haed);
geatch();
}
insertlast(node*
list)
{
node*new1;
new1=(node*)malloc(sizeof(node));
while(list->next
!=NULL)
{
list=list->next;
}
list
next=new1;
new1->next=NULL;
list->no=100;
return
list;
}
Subscribe to:
Posts
(
Atom
)