You are not logged in. Please login at to post your questions!


output modulo 10^9+7

i am newbie to codechef problems...can please anyone explain how to write the code in c or C++14 to show output modulo 10^9+7 asked in problems....plz help...if u can show a code problem for it would of great help...i know coding but i just only want to know how to show output in the given format........

asked 26 Aug '17, 23:41

sachin_123yad's gravatar image

accept rate: 0%

edited 27 Aug '17, 23:43

if you could provide a code of a problem as an example would be wonderful

(27 Aug '17, 00:08) sachin_123yad2★

if you can refer to a question involving it in practice problem

(27 Aug '17, 00:14) sachin_123yad2★

if your output is ans you just print ans%1000000007. Make sure you modulo 'ans' for every '+', '-', '*' operation.


answered 27 Aug '17, 00:00

sudip_95's gravatar image

accept rate: 10%

edited 27 Aug '17, 00:00

i need a code for example..

(27 Aug '17, 00:10) sachin_123yad2★

Hey newbie,

The easiest way is defining it as global variable as

long long mod = 1000000007;


define mod 1000000007


define mod 1e9+7

then using it in the main or other functions as asked, using some modulo properties

Hope this helps!


answered 27 Aug '17, 00:01

sandeep_007's gravatar image

accept rate: 15%

edited 27 Aug '17, 00:02

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 26 Aug '17, 23:41

question was seen: 337 times

last updated: 27 Aug '17, 23:43