Advertisement
Guest User

Certamente não sou corno

a guest
Apr 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <locale.h>
  4. #include <conio.h>
  5. #include <math.h>
  6.  
  7. int contquad(int x){
  8. int n=pow(x,2),y=x;
  9. while(x<=n){
  10.     if(x==y){
  11.         printf("\n%i ",x);
  12.     }
  13.     else{
  14.     printf("%i ",x);}
  15.     x=x+y;
  16. }
  17. }
  18.  
  19. int main()
  20. {
  21.     setlocale(LC_ALL,"portuguese");
  22.     int contlinha,n,numl=-1;
  23.     while(numl<=0){
  24.     system("cls");
  25.     printf("Insira o número de linhas: ");
  26.     scanf("%i",&numl);}
  27.  
  28.     for(n=1;n<=numl;n++){
  29.         contquad(n);
  30.     }
  31.     getch();
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement