Notes
random notes
Content of the notes (3)
Page 1
1 - for finding the size of an array in c
int arr[] = {6, 5, 12, 10, 9, 1};
int size = sizeof(arr) / sizeof(arr[0]);
printf("\n size is %d",size);
if array is of any other data type then we change it accordingly
2 - while passing an array to a function in c there's no need for square braces when it is being called but there's a need for the same in the passed function or where the function actaully is
3 - a)Interpreter translates program one statement at a time; compiler Scans the entire program and translates it as a whole into machine code.a)Interpreter translates program one statement at a time; compiler Scans the entire program and translates it as a whole into machine code.
4 - c progamming languages uses only compiler
5 -
*,/,%
Multiplication, division, modulus
6 -
+/-
Addition, subtraction
Left-to-Right
in modulo numerator ka sign ayega in ans
in divison
7 - Operator precedence determines which operator is performed first in an expression with more than one operator with different precedence. Associativity is used when two operators of same precedence appear in an expressionOperator precedence determines which operator is performed first in an expression with more than one operator with different precedence. Associativity is used when two operators of same precedence appear in an expression
Page 2
int ke liye modulo d
float ke liye modulo f
double ke liye modulo lf
ascii code value capital A se Z 65 SE 90
SMALL 97 SE 122
Page 3
* 6th july program hackerank
int howManyGames(int p, int d, int m, int s)
{
int counter=0;
while(s>=m)
{
if(p>s)
return counter;
else
s=s-p;
counter ++;
if(p-d<m)
p=m;
else
p=p-d;
}
return counter;
}
int main()
{
int p,d,m,s;
scanf("%d %d %d %d",&p,&d,&m,&s);
int ans=howManyGames(p,d,m,s);
printf("%d",ans);
}
Information
- Description
- Note on random notes, created by Tisha Wadhva on 02/07/2023.
- Created by
- Tisha Wadhva
- Views
- 1
- Rating