Advertisement
michael_xgrind

Exercicio 5

Oct 3rd, 2014
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. /* Michael Martins */
  2.  
  3. /* 5) Escreva um programa em C para ler um valor N e imprimir todos os valores inteiros
  4. entre 1 (inclusive) e N (inclusive). Considere que o N será sempre maior que ZERO. */
  5.  
  6. #include "stdio.h"
  7. #include "stdlib.h"
  8.  
  9. int main(){
  10.     int num;
  11.  
  12.     printf("Entre com um numero: ");
  13.     scanf("%d", &num);
  14.  
  15.     for(int i=1; i<=num; i++)
  16.             printf("%d ", i);
  17.  
  18.     printf("\n");
  19.     system("pause");
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement