Hafsa Software
URI problem::1020::
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
int a,b,c,d,e;
Scanner obj=new Scanner(System.in);
a=obj.nextInt();
b=a/365;
c=a%365;
d=c/30;
e=c%30;
System.out.println((b)+" ano(s)");
System.out.println((d)+" mes(es)");
System.out.println((e)+" dia(s)");
}
}
All operations of STACK: Push :Pop:Print::
CAPACITY 5 //pre processor macro
int isfull();
int isempty();
int pop();
void push(int);
void print();
int stk[CAPACITY],top=-1,ele;
void main()
{
int ch;
while(1)
{
printf("1.Push\n");
printf("2.Pop\n");
printf("3.Print\n");
printf("press 4 for exit\n");
printf("Enter your choice\n");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("Enter the element you want to push\n");
scanf("%d",&ele);
push(ele);
break;
case 2:
ele=pop();
if(ele!=0)
printf("deleted elements is %d",ele) ;
break;
case 3:
print();
break;
case 4:
exit(0);
default:
printf("invalid option");
break;
}
}
}
int isfull()
{
if(top==CAPACITY-1)
{
return 1;
}
else
{
return 0;
}
}
int isempty()
{
if(top==-1)
{
return 1;
}
else
{
return 0;
}
}
void push(int ele)
{
if (isfull())
{
printf("Stack is overflow\n");
}
else
{
top++;
stk[top]=ele;
printf("%d pushed\n",ele);
}
}
int pop()
{
if(isempty())
{
printf("stack is empty\n");
}
else
{
return stk[top--];
}
}
void print()
{
int i;
if(isempty())
{
printf("stack is Empty\n");
}
else
{
printf("Full stack is ::\n") ;
for(i=0;i
Click here to claim your Sponsored Listing.
Category
Contact the business
Telephone
Website
Address
Gazipur
1702