Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ans 02.D.
- ============
- #include<stdio.h>
- #include<conio.h>
- #include<ctype.h>
- #include<stdlib.h>
- #include<string.h>
- int main()
- {
- int a,aa, b, zmn[1000];
- printf("input how many person?");
- scanf("%d",&aa);
- int xxx;
- char press;
- for (int z = 0; z < aa; z++)
- {
- printf("Person %d\n",z+1);
- printf("How many product?\n");
- scanf("%d",&a);
- for (int i = 0; i < a; i++)
- {
- scanf("%d",&zmn[i]);
- }
- printf("Press M for male\nPress F for female\n");
- press=toupper(getch());
- if (press=='M')
- {
- xxx = zmn[0];
- for (int j = 0; j < a-1; j++)
- {
- xxx = xxx - zmn[j+1];
- }
- printf("%d\n",xxx);
- }
- else if (press=='F')
- {
- xxx = zmn[0];
- for (int k = 0; k < a-1; k++)
- {
- xxx = xxx + zmn[k+1];
- }
- printf("%d\n",xxx);
- }
- else{
- printf("Error\n");
- }
- }
- return 0;
- }
- ==============
- and 02.a
- ==============
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char s[100];
- gets(s);
- strrev(s);
- printf("%s\n", s);
- return 0;
- }
- ============
- ans 02.c
- ==========
- #include<stdio.h>
- int main()
- {
- int Day,Hours,Minutes,Second,a,b;
- printf("Enter your Input:\n");
- scanf("%d",&Second);
- Day=Second/65059;
- a= Second % 65059;
- Hours= a/1513;
- b= a % 1513;
- Minutes = b/89;
- Second= b%89;
- printf("Output Will be:\n%d days %d hours %d minutes %d seconds",Day,Hours,Minutes,Second);
- }
- ==========
- ANS 02.B
- ===========
- #include <stdio.h>
- //UserSnippetBy ZAMAN SHEIKH v0.1
- int main()
- {
- int n;
- scanf("%d",&n);
- float a[100];
- float b[100];
- float c;
- for (int i = 0; i < n; i++)
- {
- scanf("%f",&a[i]);
- }
- for (int j = 4; j < n +4; j++)
- {
- if ( j % 4 == 0)
- {
- b[j] = a[j-4] + a[j -3];
- c =b[j];
- }
- else if ( j % 4 == 1)
- {
- b[j] = b[j-1] - a[j -2];
- c =b[j];
- }
- else if ( j % 4 == 2)
- {
- b[j] = b[j-1] * a[j -2];
- c =b[j];
- }
- else if ( j % 4 == 3)
- {
- b[j] = b[j-1] / a[j -2];
- c =b[j];
- }
- }
- if (c == 031) // id 4031
- {
- printf(" “I am not a liar.\n");
- }
- else{
- printf("Liar Liar!! Big Cheater!");
- }
- printf("\n");
- return 0;
- }
- ==========
- ANS 02.e
- ============
- Abdullah Al Mamun
- #include<stdio.h>
- int series(int n)
- {
- if (n <= 1)
- return n;
- return series(n-1) + series(n-2) + series(n-3);
- }
- int main ()
- {
- int n, num;
- scanf("%d", &n);
- num=n+2;
- printf("%d", series(num));
- getchar();
- return 0;
- }
- ======
- 01.a
- ======
- Ans to the Question No.-(1)
- ======================
- #include<stdlib.h>
- struct PPS{
- int C,S,E;
- char dept[12]; //Increase array size
- } PPS1={3,2,1};
- typedef struct PPS P;
- int main()
- {
- struct PPS p={1,2,3,"PPS and CSE"};
- struct PPS pp={3,3,3};// pps pp & structure decalar
- struct PPS q={1,"skjr",5,6};
- printf("%d %d %d\n", p.C,p.S,p.E); //use small p
- printf("%d %d %d\n", pp.C,pp.S,pp.E); //use capital C
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement