Algorithm
Problem Name: beecrowd | 2752
Problem Link: https://www.beecrowd.com.br/judge/en/problems/view/2752
Output 6
By Roberto A. Costa Jr, UNIFEI Brazil
Timelimit: 1
Your teacher would like you to do a program with the following characteristics:
- Create a variable to store 50 characters;
- Assign the variable before the phrase: "AMO FAZER EXERCICIO NO URI";
- Show in the first line the <character, the value stored in the variable with the format "% s" and the character>;
- Show in the next line the character <, the value stored in the variable with the format "% 30s" and the character>;
- Show in the next line the <, the value stored in the variable with the format "% .20s" and the character>;
- Show in the following line the <character, the value stored in the variable with the format "% -20s" and the character>;
- Show in the next line the <character, the value stored in the variable with the format "% -30s" and the character>;
- Show in the next line the <character, the value stored in the variable with the format "% .30s" and the character>;
- Show in the next line the <character, the value stored in the variable with the format "% 30.20s" and the character>;
- Show in the next line the <character, the value stored in the variable with the format "% -30.20s" and the character>;
Input
There is not.
Output
The result of your program should be written according to the output example.
Input Sample | Output Sample |
<AMO FAZER EXERCICIO NO URI> < AMO FAZER EXERCICIO NO URI> <AMO FAZER EXERCICIO > <AMO FAZER EXERCICIO NO URI> <AMO FAZER EXERCICIO NO URI > <AMO FAZER EXERCICIO NO URI> < AMO FAZER EXERCICIO > <AMO FAZER EXERCICIO > |
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include <cstdio>
#include <string>
using namespace std;
int main()
{
string s="AMO FAZER EXERCICIO NO URI";
printf(" < %s>\n", s.c_str());
printf("<%30s>\n", s.c_str());
printf(" < %.20s>\n", s.c_str());
printf("<%-20s>\n", s.c_str());
printf(" < %-30s>\n", s.c_str());
printf("<%.30s>\n", s.c_str());
printf(" < %30.20s>\n", s.c_str());
printf("<%-30.20s>\n", s.c_str());
return 0;
}
Copy The Code &
Try With Live Editor
Output
#2 Code Example with Java Programming
Code -
Java Programming
public class Main {
public static void main(String[] args) {
int a,b;
System.out.printf(" < AMO FAZER EXERCICIO NO URI>\n");
System.out.printf("< AMO FAZER EXERCICIO NO URI>\n");
System.out.printf(" < AMO FAZER EXERCICIO >\n");
System.out.printf("\n");
System.out.printf(" < AMO FAZER EXERCICIO NO URI >\n");
System.out.printf("\n");
System.out.printf(" < AMO FAZER EXERCICIO >\n");
System.out.printf("\n");
}
}
Copy The Code &
Try With Live Editor
Output
#3 Code Example with Javascript Programming
Code -
Javascript Programming
console.log("")
console.log("< AMO FAZER EXERCICIO NO URI>")
console.log("")
console.log("")
console.log("")
console.log("")
console.log("< AMO FAZER EXERCICIO >")
console.log("")
Copy The Code &
Try With Live Editor
Output