Advertisement
shohan11421

summer 17 (3no)

Mar 7th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.16 KB | None | 0 0
  1. 3)
  2.  
  3. a)
  4.  
  5. #include<stdio.h>
  6. int main()
  7. {
  8.     int a, b, i, temp;
  9.     scanf("%d %d", &a, &b);
  10.     if(b % a == 0) printf("Sao Multiplos\n");
  11.     else printf("Nao sao Multiplos\n");
  12.     return 0;
  13. }
  14.  
  15. b)
  16.  
  17. #include<stdio.h>
  18. int main()
  19. {
  20.     char str[40], st[40];
  21.     gets(str);
  22.     gets(st);
  23.     printf("%s %s\n", str, st);
  24.     return 0;
  25. }
  26.  
  27. c)
  28.  
  29. #include<stdio.h>
  30. #include<string.h>
  31. int main()
  32. {
  33.     int i, len, count = 0, count2 =0;
  34.     char str[40];
  35.     gets(str);
  36.     len = strlen(str);
  37.     for(i = 0; i < len; i++)
  38.     {
  39.         if(str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == 'U') count++;
  40.         if ((str[i] >= 'B' && str[i] <= 'Z')&&(str[i] != 'A' || str[i] != 'E' || str[i] != 'I' || str[i] != 'O' || str[i] != 'U')) count2++;
  41.     }
  42.     printf("%d Vowels and %d Consonants\n", count, count2);
  43.     return 0;
  44. }
  45.  
  46.  
  47.  
  48. d)
  49.  
  50. #include<stdio.h>
  51. int main()
  52. {
  53.     double c[] = {10,20,30,40,50};
  54.     double f[5];
  55.     int i;
  56.     for(i = 0; i < 5; i++)
  57.     {
  58.         f[i] = ((9/5)*c[i]) +32;
  59.     }
  60.     for(i = 0; i < 5; i++)
  61.     {
  62.         printf("%0.1lf ", f[i]);
  63.     }
  64.     printf("\n");
  65.     return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement