Skip to content

Instantly share code, notes, and snippets.

@rajurayhan
Last active August 29, 2015 14:17
Show Gist options
  • Save rajurayhan/b0ce2f8e2025d7497a94 to your computer and use it in GitHub Desktop.
Save rajurayhan/b0ce2f8e2025d7497a94 to your computer and use it in GitHub Desktop.
URI Solution
#include<stdio.h>
int main(){
float a;
scanf("%f",&a);
if(a>=0&&a<=25)
printf("Intervalo [0,25]\n");
else if(a>25&&a<=50)
printf("Intervalo (25,50]\n");
else if(a>50&&a<=75)
printf("Intervalo (50,75]\n");
else if(a>75&&a<=100)
printf("Intervalo (75,100]\n");
else if(a<0||a>100)
printf("Fora de intervalo\n");
return 0;
}
#include<stdio.h>
int main(){
int a,b;
float total=0;
scanf("%d %d", &a, &b);
switch(a){
case 1:{
total=4.00*b;
printf("Total: R$ %.2f", total);
break;
}
case 2: {
total=4.50*b;
printf("Total: R$ %.2f", total);
break;
}
case 3: {
total=5.00*b;
printf("Total: R$ %.2f", total);
break;
}
case 4: {
total=2.00*b;
printf("Total: R$ %.2f", total);
break;
}
case 5: {
total=1.50*b;
printf("Total: R$ %.2f", total);
break;
}
default :
printf("Wrong\n");
break;
}
return 0;
}
#include<stdio.h>
int main(){
int a,b,c,d;
scanf("%d %d %d %d", &a, &b, &c, &d);
if(b>c&&d>a&&c+d>a+b&&c>0&&d>0&&a%2==0)
printf("Valores aceitos\n");
else
printf("Valores nao aceitos\n");
return 0;
}
#include<stdio.h>
int main(){
float x,y;
scanf("%f %f", &x, &y);
if(x==0&&y==0)
printf("Origem\n");
else if(x!=0&&y==0)
printf("Eixo X\n");
else if(y!=0&&x==0)
printf("Eixo Y\n");
else if(x>0&&y>0)
printf("Q1\n");
else if(x>0&&y<0)
printf("Q4\n");
else if(x<0&&y>0)
printf("Q2\n");
else if(x<0&&y<0)
printf("Q3\n");
return 0;
}
#include <iostream>
using namespace std;
class Triangle{
private:
float a, b, c, area=0, per=0;
public:
void get(){
cin>>a>>b>>c;
}
void show(){
if((a+b)>c&&(a+c)>b&&(b+c)>a){
per=(a+b+c);
printf("Perimetro = %.1f\n",per);
}
else{
area=((a+b)*c)/2;
printf("Area = %.1f\n",area);
}
}
};
int main(){
Triangle t;
t.get();
t.show();
return 0;
}
@rajurayhan
Copy link
Author

include<stdio.h>

int main(){
float x,y;
scanf("%f %f", &x, &y);
if(x>0.0)
{
if(y>0.0)
printf("Q1\n");
else if(y<0.0)
printf("Q4\n");
}
else if(x<0.0)
{
if(y>0.0)
printf("Q2\n");
else if(y<0.0)
printf("Q3\n");
}
else if(x!=0&&y==0)
printf("Eixo X\n");
else if(y!=0&&x==0)
printf("Eixo Y\n");
else
printf("Origem\n");
return 0;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment